-
Notifications
You must be signed in to change notification settings - Fork 2.3k
add wrapper method to call mc.cfg.Logger #1563
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
Conversation
WalkthroughThe recent modifications involve consolidating logging operations across several files ( Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (4)
- auth.go (1 hunks)
- connection.go (9 hunks)
- packets.go (12 hunks)
- statement.go (2 hunks)
Additional comments: 25
statement.go (2)
- 54-54: The change to use
stmt.mc.log(ErrInvalidConn)
centralizes logging, which is a good practice. Ensure that thelog
method inmysqlConn
is implemented to handle various log message types effectively.- 98-98: Similar to the change in the
Exec
method, usingstmt.mc.log(ErrInvalidConn)
here centralizes logging. Ensure thelog
method inmysqlConn
handles different types of log messages effectively.auth.go (1)
- 341-341: Changing to use
mc.log("unknown auth plugin:", plugin)
centralizes logging, which is beneficial. Ensure thelog
method inmysqlConn
can handle string concatenation and variable logging effectively.connection.go (10)
- 48-51: The introduction of the
log
method inmysqlConn
centralizes logging, which is a good practice. Ensure thatmc.cfg.Logger
is always properly initialized and supports the- 118-118: Using
mc.log(ErrInvalidConn)
centralizes logging, enhancing maintainability. Ensure that log messages retain necessary context for clarity.- 160-160: Centralizing logging with
mc.log(err)
is beneficial. Verify that error contexts are preserved in log messages for effective debugging.- 177-177: The use of
mc.log(ErrInvalidConn)
for logging is consistent with the centralization effort. Ensure log messages are clear and provide sufficient context.- 184-184: Logging errors with
mc.log(err)
helps centralize logging. Check that the log method effectively handles different types of errors.- 218-218: Centralizing logging to
mc.log(err)
is a good practice. Ensure that the log messages are informative and maintain context.- 310-310: Using
mc.log(ErrInvalidConn)
for logging centralizes the logging mechanism. Confirm that all necessary context is included in log messages.- 370-370: The change to use
mc.log(ErrInvalidConn)
for logging is consistent with centralizing logging. Ensure that log messages are clear and contextual.- 465-465: Centralizing logging with
mc.log(ErrInvalidConn)
is beneficial. Verify that the log method handles context and clarity in log messages effectively.- 674-674: Using
mc.log("closing bad idle connection: ", err)
centralizes logging. Ensure that the log method can handle concatenation of strings and variables effectively.packets.go (12)
- 37-37: The introduction of the
log
method in themysqlConn
struct for logging errors is a positive change, enhancing the maintainability and consistency of logging throughout the codebase.- 60-60: Using the
log
method for logging malformed packet errors before closing the connection is consistent with the PR's objective to centralize logging. This change improves code readability and maintainability.- 74-74: The use of the
log
method for error logging here follows the PR's goal of centralizing logging. This approach simplifies the process of modifying logging behavior in the future.- 137-137: Logging the malformed packet error using the new
log
method before cleanup is in line with the PR's objectives. It ensures that logging is handled in a consistent manner across the codebase.- 147-147: Applying the
log
method for error logging in this context is appropriate and aligns with the PR's aim to centralize and standardize logging practices within the project.- 305-305: The use of the
log
method for logging errors when unable to take a buffer is consistent with the PR's goal. It centralizes logging, making it easier to manage and modify logging behavior.- 395-395: Employing the
log
method for error logging in this scenario adheres to the PR's objective of centralizing logging. This change enhances the code's maintainability.- 415-415: Utilizing the
log
method for logging errors when a buffer cannot be taken aligns with the PR's aim to centralize logging. This contributes to a more maintainable and consistent codebase.- 434-434: The application of the
log
method for error logging here is in line with the PR's objectives. It centralizes logging, facilitating easier future modifications to logging behavior.- 455-455: Using the
log
method for error logging in this context supports the PR's goal of centralizing logging. This approach simplifies logging management across the codebase.- 997-997: The use of the
log
method for logging errors when a buffer cannot be taken is consistent with the PR's objectives. It centralizes logging, enhancing code maintainability.- 1196-1196: Employing the
log
method for error logging in this scenario adheres to the PR's aim of centralizing logging. This change contributes to a more maintainable codebase.
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.
LGTM
(cherry picked from commit 1a64773)
go-sql-driver#1563 broke the filename:lineno prefix in the log message by introducing a helper function. This commit adds the "filename:line" prefix in the helper function instead of log.Lshortfile option to show correct filename:lineno.
#1563 broke the filename:lineno prefix in the log message by introducing a helper function. This commit adds the "filename:line" prefix in the helper function instead of log.Lshortfile option to show correct filename:lineno.
go-sql-driver#1563 broke the filename:lineno prefix in the log message by introducing a helper function. This commit adds the "filename:line" prefix in the helper function instead of log.Lshortfile option to show correct filename:lineno. (cherry picked from commit 2f7015e)
Description
This is just a code cleanup. I will backport this to 1.8 too.
Checklist
Summary by CodeRabbit