-
Notifications
You must be signed in to change notification settings - Fork 1k
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
resolve #1060
base: master
Are you sure you want to change the base?
resolve #1060
Conversation
There was a problem hiding this 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! 😊 While you've made great progress, there are a few critical issues that need to be addressed before we can approve it:
-
Logger Configuration: The task requires configuring the logger with appenders for both File and Console, which is currently missing. This is crucial for meeting the task requirements.
-
Informative Log Messages: The log messages need to be more informative. For example, instead of
logger.info("Login method was called")
, consider including parameters or context to make the logs more useful. -
User Initialization: The
user
variable inMain.java
is declared but not initialized. This can lead to issues if thelogin
method throws an exception. Ensure it is initialized tonull
or handle the login failure scenario more gracefully. -
Order Constructor: The
Order(Long orderId)
constructor does not initialize theorderId
field. Make sure to setthis.orderId = orderId;
to properly initialize it. -
.gitignore Configuration: The syntax for ignoring the
logs
directory is incorrect. It should belogs/
instead of/logs
. This ensures that log files are not pushed to GitHub.
Please address these issues to ensure the code meets all specified requirements. Once these are resolved, we can move forward with approval. Keep up the great work, and don't hesitate to reach out if you have any questions! 🚀
✨ 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.
There was a problem hiding this 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 submission! 🎉 You've made great progress, but there are a few areas that need attention to enhance your code's functionality and maintainability. Here are some key points to address:
-
Logger Configuration: It's crucial to configure the logger with appenders for both File and Console as per the task requirements. This ensures that logs are properly recorded and accessible.
-
Informative Log Messages: Enhance your log messages by including relevant parameters or context. For example, in the
login
method, consider adding the login parameter to provide more insight into the log entry. -
Order Constructor: Ensure that the
orderId
field is initialized in theOrder(Long orderId)
constructor. This is essential for the correct functioning of your order management. -
.gitignore Syntax: Correct the syntax for ignoring the
logs
directory by usinglogs/
. This prevents unnecessary log files from being pushed to GitHub. -
User Initialization in Main.java: Initialize the
user
variable to avoid potential issues if thelogin
method throws an exception.
These improvements will not only align your code with the task requirements but also enhance its overall quality. Keep up the good work, and continue learning from these experiences to refine your skills! 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
@@ -1,3 +1,4 @@ | |||
.idea/* | |||
*.iml | |||
target/* | |||
/logs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The syntax for ignoring the logs
directory is incorrect. It should be logs/
instead of /logs
. This ensures that log files are not pushed to GitHub.
|
||
public class Main { | ||
private static final Logger logger = LogManager.getLogger(Main.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logger configuration is missing appenders for both File and Console. According to the task description, you need to configure the logger with these appenders .
|
||
public class Main { | ||
private static final Logger logger = LogManager.getLogger(Main.class); | ||
|
||
public static void main(String[] args) { | ||
AuthenticationService authenticationService = new AuthenticationServiceImpl(); | ||
User user; | ||
try { | ||
user = authenticationService.login("bob", "1234"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The log message in the login
method should be more informative. Consider including parameters or context to make the logs more useful, as suggested in the checklist .
@@ -7,7 +7,7 @@ public class Order { | |||
private List<Product> products; | |||
private Long userId; // the identifier of user who complete the order | |||
|
|||
public Order() { | |||
public Order(Long orderId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The orderId
field is not initialized in this constructor. You should set this.orderId = orderId;
to properly initialize it.
@Override | ||
public User login(String login, String password) throws AuthenticationException { | ||
//TODO: add corresponding log message about method login was called | ||
logger.info("Login method was called"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The log message 'Login method was called' is not very informative. Consider including the login parameter or other context to make the log more useful, as suggested in the checklist.
@Override | ||
public Order completeOrder(Long userId) { | ||
// TODO: add log message about method completeOrder was called | ||
logger.info("CompleteOrder method was called"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The log message 'CompleteOrder method was called' is not very informative. Consider including the userId parameter or other context to make the log more useful, as suggested in the checklist.
@@ -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.info("Successful fetched data from DB"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The log message 'Successful fetched data from DB' could be more informative. Consider including details about the userId or the number of products fetched to provide more context.
No description provided.