-
Notifications
You must be signed in to change notification settings - Fork 39
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
Loggers: use log format rather than terminal format for files #1751
Conversation
WalkthroughThe change involves modifying the logging behavior in two Go files. When setting up file handlers for logging, the format has been switched from a terminal-based format to a logfmt-based format, provided that the output destination is not the system's standard output. This adjustment likely aims to enhance the readability or processing of log files by using a structured logging format that is more suitable for 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 (2)
- go/common/log/log.go (1 hunks)
- integration/common/testlog/testlog.go (1 hunks)
Additional comments: 2
integration/common/testlog/testlog.go (1)
- 48-48: The change from
TerminalFormat
toLogfmtFormat
aligns with the PR's objective to ensure full hashes are logged in file outputs. This change should resolve the issue with truncated hashes.go/common/log/log.go (1)
- 61-61: The update to use
LogfmtFormat
for file handlers when the output is notSysOut
is consistent with the PR's goal to improve log detail in file outputs. This should ensure that logs contain complete hashes for better debugging.
Why this change is needed
I'm getting frustrated fairly regularly by shortened hashes, like the tx hash in this log msg:
It means you can't do a lookup by hash for whatever the item is. And it's happening automatically because we use a Terminal log formatter even for loggers that write to files.
What changes were made as part of this PR
Changes the formatter to log formatter unless it's streaming to SysOut.
PR checks pre-merging
Please indicate below by ticking the checkbox that you have read and performed the required
PR checks