Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hw solution #1066

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

hw solution #1066

wants to merge 2 commits into from

Conversation

sergiikonov
Copy link

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your hard work on this pull request! 😊 There are a few critical issues that need to be addressed before we can approve it. The main concern is the missing logger configuration for File and Console appenders, which is a core requirement of the task. Additionally, while your log messages are generally informative, using parameterized logging instead of string concatenation will improve performance and readability. Please make these changes, and feel free to reach out if you have any questions. Keep up the great work! 🚀

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review button in the Reviewers tab.

Comment on lines 20 to 21
} catch (AuthenticationException e) {
e.printStackTrace();
logger.error("AuthenticationException with incorrect data.");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log message could be more informative. Consider including details about the exception or the parameters that caused the exception, as suggested in the checklist: logger.debug("Method login was called. Params: login={}, password={}", login, password);.

@Override
public User login(String login, String password) throws AuthenticationException {
//TODO: add corresponding log message about method login was called
logger.debug("Method login was called. Params: login= " + login);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use parameterized logging instead of string concatenation for better performance and readability. Change to: logger.debug("Method login was called. Params: login={}", login); as suggested in the checklist.

@Override
public Order completeOrder(Long userId) {
// TODO: add log message about method completeOrder was called
logger.debug("Method completeOrder was called.");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider including the userId parameter in the log message for better traceability. For example: logger.debug("Method completeOrder was called. Params: userId={}", userId);.

@@ -24,7 +28,7 @@ private List<Product> getAllProductsFromShoppingCart(Long userId) {
Product macBook = new Product("MacBook Air 2020", BigDecimal.valueOf(1399));
Product xiaomi = new Product("Xiaomi 12", BigDecimal.valueOf(499));
List<Product> products = List.of(iphone, macBook, xiaomi);
// TODO: add log message about successful fetched data from DB
logger.debug("Successful fetched data from DB.");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log message could be more informative by including the userId parameter. Consider changing it to: logger.debug("Successfully fetched data from DB for userId={}", userId);.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job on your submission! 🎉 While the overall structure is solid, there are a few critical areas to address to enhance your code:

  1. Logger Configuration: Ensure that the logger is configured with appenders for both File and Console as per the task requirements. This is crucial for comprehensive logging.

  2. Parameterized Logging: In the Main class, replace string concatenation with parameterized logging for better performance and readability. For example, use logger.error("Method login was called. Params: login = {}", login, e);.

  3. .gitignore: Your .gitignore file is well-configured to exclude unnecessary files, which helps keep the repository clean.

Remember, these improvements are essential for the functionality and maintainability of your code. Addressing these issues will not only help you meet the task requirements but also enhance your coding skills. Keep up the great work and continue learning from these experiences! 🚀

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

Comment on lines +9 to +10
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the logger is configured with appenders for both File and Console as per the task requirements.

public static void main(String[] args) {
AuthenticationService authenticationService = new AuthenticationServiceImpl();
User user;
try {
user = authenticationService.login("bob", "1234");
} catch (AuthenticationException e) {
e.printStackTrace();
logger.error("Method login was called. Params: login = ", e);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use parameterized logging instead of string concatenation for better performance and readability. For example: logger.error("Method login was called. Params: login = {}", login, e);.

Comment on lines +5 to +6
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the logger is configured with appenders for both File and Console as per the task requirements.

Comment on lines +7 to +8
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the logger is configured with appenders for both File and Console as per the task requirements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants