- Notifications
You must be signed in to change notification settings - Fork 2.3k
log: add "filename:line" prefix by ourself#1589
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
methane commented May 19, 2024 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
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.
coderabbitaibot commented May 19, 2024 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
WalkthroughThe MySQL connection code now provides enhanced logging with file name and line number details for better debugging. The 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.
Actionable comments posted: 2
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- connection.go (2 hunks)
- errors.go (1 hunks)
Files skipped from review due to trivial changes (1)
- errors.go
Additional Context Used
GitHub Check Runs (25)
test (ubuntu-latest, 1.20, 8.0) failure (5)
connection.go: [failure] 55-55:
undefined: posconnection.go: [failure] 56-56:
undefined: posconnection.go: [failure] 57-57:
undefined: posconnection.go: [failure] 62-62:
too many arguments in call to mc.cfg.Logger.Printtest (ubuntu-latest, 1.21, 8.0) failure (5)
connection.go: [failure] 55-55:
undefined: posconnection.go: [failure] 56-56:
undefined: posconnection.go: [failure] 57-57:
undefined: posconnection.go: [failure] 62-62:
too many arguments in call to mc.cfg.Logger.Printtest (windows-latest, 1.22, mariadb-10.6) failure (5)
connection.go: [failure] 55-55:
undefined: posconnection.go: [failure] 56-56:
undefined: posconnection.go: [failure] 57-57:
undefined: posconnection.go: [failure] 62-62:
too many arguments in call to mc.cfg.Logger.Printtest (windows-latest, 1.22, mariadb-10.11) failure (5)
connection.go: [failure] 55-55:
undefined: posconnection.go: [failure] 56-56:
undefined: posconnection.go: [failure] 57-57:
undefined: posconnection.go: [failure] 62-62:
too many arguments in call to mc.cfg.Logger.Printtest (windows-latest, 1.22, mariadb-11.1) failure (5)
connection.go: [failure] 55-55:
undefined: posconnection.go: [failure] 56-56:
undefined: posconnection.go: [failure] 57-57:
undefined: posconnection.go: [failure] 62-62:
too many arguments in call to mc.cfg.Logger.Printtest (windows-latest, 1.22, 5.7) failure (5)
connection.go: [failure] 55-55:
undefined: posconnection.go: [failure] 56-56:
undefined: posconnection.go: [failure] 57-57:
undefined: posconnection.go: [failure] 62-62:
too many arguments in call to mc.cfg.Logger.Printtest (windows-latest, 1.22, 8.3) failure (5)
connection.go: [failure] 55-55:
undefined: posconnection.go: [failure] 56-56:
undefined: posconnection.go: [failure] 57-57:
undefined: posconnection.go: [failure] 62-62:
too many arguments in call to mc.cfg.Logger.Printtest (windows-latest, 1.22, 8.0) failure (5)
connection.go: [failure] 55-55:
undefined: posconnection.go: [failure] 56-56:
undefined: posconnection.go: [failure] 57-57:
undefined: posconnection.go: [failure] 62-62:
too many arguments in call to mc.cfg.Logger.Printtest (macos-latest, 1.22, mariadb-10.5) failure (5)
connection.go: [failure] 55-55:
undefined: posconnection.go: [failure] 56-56:
undefined: posconnection.go: [failure] 57-57:
undefined: posconnection.go: [failure] 62-62:
too many arguments in call to mc.cfg.Logger.Printtest (macos-latest, 1.22, mariadb-10.6) failure (5)
connection.go: [failure] 55-55:
undefined: posconnection.go: [failure] 56-56:
undefined: posconnection.go: [failure] 57-57:
undefined: posconnection.go: [failure] 62-62:
too many arguments in call to mc.cfg.Logger.Printtest (macos-latest, 1.22, mariadb-10.11) failure (5)
connection.go: [failure] 55-55:
undefined: posconnection.go: [failure] 56-56:
undefined: posconnection.go: [failure] 57-57:
undefined: posconnection.go: [failure] 62-62:
too many arguments in call to mc.cfg.Logger.Printtest (macos-latest, 1.22, mariadb-11.1) failure (5)
connection.go: [failure] 55-55:
undefined: posconnection.go: [failure] 56-56:
undefined: posconnection.go: [failure] 57-57:
undefined: posconnection.go: [failure] 62-62:
too many arguments in call to mc.cfg.Logger.Printtest (macos-latest, 1.22, mariadb-11.3) failure (5)
connection.go: [failure] 55-55:
undefined: posconnection.go: [failure] 56-56:
undefined: posconnection.go: [failure] 57-57:
undefined: posconnection.go: [failure] 62-62:
too many arguments in call to mc.cfg.Logger.Printtest (macos-latest, 1.22, 5.7) failure (5)
connection.go: [failure] 55-55:
undefined: posconnection.go: [failure] 56-56:
undefined: posconnection.go: [failure] 57-57:
undefined: posconnection.go: [failure] 62-62:
too many arguments in call to mc.cfg.Logger.Printtest (macos-latest, 1.22, 8.3) failure (5)
connection.go: [failure] 55-55:
undefined: posconnection.go: [failure] 56-56:
undefined: posconnection.go: [failure] 57-57:
undefined: posconnection.go: [failure] 62-62:
too many arguments in call to mc.cfg.Logger.Printtest (macos-latest, 1.22, 8.0) failure (5)
connection.go: [failure] 55-55:
undefined: posconnection.go: [failure] 56-56:
undefined: posconnection.go: [failure] 57-57:
undefined: posconnection.go: [failure] 62-62:
too many arguments in call to mc.cfg.Logger.Printtest (ubuntu-latest, 1.22, mariadb-10.5) failure (5)
connection.go: [failure] 55-55:
undefined: posconnection.go: [failure] 56-56:
undefined: posconnection.go: [failure] 57-57:
undefined: posconnection.go: [failure] 62-62:
too many arguments in call to mc.cfg.Logger.Printtest (ubuntu-latest, 1.22, mariadb-10.6) failure (5)
connection.go: [failure] 55-55:
undefined: posconnection.go: [failure] 56-56:
undefined: posconnection.go: [failure] 57-57:
undefined: posconnection.go: [failure] 62-62:
too many arguments in call to mc.cfg.Logger.Printtest (ubuntu-latest, 1.22, mariadb-10.11) failure (5)
connection.go: [failure] 55-55:
undefined: posconnection.go: [failure] 56-56:
undefined: posconnection.go: [failure] 57-57:
undefined: posconnection.go: [failure] 62-62:
too many arguments in call to mc.cfg.Logger.Printtest (ubuntu-latest, 1.22, mariadb-11.1) failure (5)
connection.go: [failure] 55-55:
undefined: posconnection.go: [failure] 56-56:
undefined: posconnection.go: [failure] 57-57:
undefined: posconnection.go: [failure] 62-62:
too many arguments in call to mc.cfg.Logger.Printtest (ubuntu-latest, 1.22, mariadb-11.3) failure (5)
connection.go: [failure] 55-55:
undefined: posconnection.go: [failure] 56-56:
undefined: posconnection.go: [failure] 57-57:
undefined: posconnection.go: [failure] 62-62:
too many arguments in call to mc.cfg.Logger.Printtest (ubuntu-latest, 1.22, 5.7) failure (5)
connection.go: [failure] 55-55:
undefined: posconnection.go: [failure] 56-56:
undefined: posconnection.go: [failure] 57-57:
undefined: posconnection.go: [failure] 62-62:
too many arguments in call to mc.cfg.Logger.Printtest (ubuntu-latest, 1.22, 8.3) failure (5)
connection.go: [failure] 55-55:
undefined: posconnection.go: [failure] 56-56:
undefined: posconnection.go: [failure] 57-57:
undefined: posconnection.go: [failure] 62-62:
too many arguments in call to mc.cfg.Logger.Printtest (ubuntu-latest, 1.22, 8.0) failure (5)
connection.go: [failure] 55-55:
undefined: posconnection.go: [failure] 56-56:
undefined: posconnection.go: [failure] 57-57:
undefined: posconnection.go: [failure] 62-62:
too many arguments in call to mc.cfg.Logger.Printlint failure (10)
connection.go: [failure] 55-55:
undefined: posconnection.go: [failure] 56-56:
undefined: posconnection.go: [failure] 57-57:
undefined: posconnection.go: [failure] 62-62:
too many arguments in call to mc.cfg.Logger.Printconnection.go: [failure] 55-55:
undefined: posconnection.go: [failure] 56-56:
undefined: posconnection.go: [failure] 57-57:
undefined: posconnection.go: [failure] 62-62:
too many arguments in call to mc.cfg.Logger.Print
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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.
Actionable comments posted: 0
coveralls commented May 19, 2024
shogo82148 left a comment
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
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)
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql) | require | minor | `v1.8.1` -> `v1.9.1` | --- ### Release Notes <details> <summary>go-sql-driver/mysql (github.com/go-sql-driver/mysql)</summary> ### [`v1.9.1`](https://github.com/go-sql-driver/mysql/blob/HEAD/CHANGELOG.md#v191-2025-03-21) [Compare Source](go-sql-driver/mysql@v1.9.0...v1.9.1) ##### Major Changes - Add Charset() option. ([#​1679](go-sql-driver/mysql#1679)) ##### Bugfixes - go.mod: fix go version format ([#​1682](go-sql-driver/mysql#1682)) - Fix FormatDSN missing ConnectionAttributes ([#​1619](go-sql-driver/mysql#1619)) ### [`v1.9.0`](https://github.com/go-sql-driver/mysql/blob/HEAD/CHANGELOG.md#v190-2025-02-18) [Compare Source](go-sql-driver/mysql@v1.8.1...v1.9.0) ##### Major Changes - Implement zlib compression. ([#​1487](go-sql-driver/mysql#1487)) - Supported Go version is updated to Go 1.21+. ([#​1639](go-sql-driver/mysql#1639)) - Add support for VECTOR type introduced in MySQL 9.0. ([#​1609](go-sql-driver/mysql#1609)) - Config object can have custom dial function. ([#​1527](go-sql-driver/mysql#1527)) ##### Bugfixes - Fix auth errors when username/password are too long. ([#​1625](go-sql-driver/mysql#1625)) - Check if MySQL supports CLIENT_CONNECT_ATTRS before sending client attributes. ([#​1640](go-sql-driver/mysql#1640)) - Fix auth switch request handling. ([#​1666](go-sql-driver/mysql#1666)) ##### Other changes - Add "filename:line" prefix to log in go-mysql. Custom loggers now show it. ([#​1589](go-sql-driver/mysql#1589)) - Improve error handling. It reduces the "busy buffer" errors. ([#​1595](go-sql-driver/mysql#1595), [#​1601](go-sql-driver/mysql#1601), [#​1641](go-sql-driver/mysql#1641)) - Use `strconv.Atoi` to parse max_allowed_packet. ([#​1661](go-sql-driver/mysql#1661)) - `rejectReadOnly` option now handles ER_READ_ONLY_MODE (1290) error too. ([#​1660](go-sql-driver/mysql#1660)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - "* 0-3 * * *" (UTC), Automerge - "* 0-3 * * *" (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMDUuMSIsInVwZGF0ZWRJblZlciI6IjM5LjIwNS4xIiwidGFyZ2V0QnJhbmNoIjoiZm9yZ2VqbyIsImxhYmVscyI6WyJkZXBlbmRlbmN5LXVwZ3JhZGUiLCJ0ZXN0L25vdC1uZWVkZWQiXX0=--> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7293 Reviewed-by: Earl Warren <[email protected]> Co-authored-by: Renovate Bot <[email protected]> Co-committed-by: Renovate Bot <[email protected]>
#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.
Checklist