-
Notifications
You must be signed in to change notification settings - Fork 183
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
Add log encoding option for JSON logging. #2166
base: main
Are you sure you want to change the base?
Conversation
This option allows selection of either CONSOLE (the default, and the current behaviour) or JSON for log output, allowing for easier parsing of output for structued log backends.
this is a great addition. hope this is merged in soon. curious why you chose to call it encoding, instead of format |
Encoding is the term used internally in the logging. Also, format can be the format for individual fields (e.g. timestamp format) rather than the general encoding of the log entry. |
Signed-off-by: Jim McDonald <[email protected]>
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 - however linter fixes required
@pnowosie should be fixed, but workflows need running to confirm. |
Oops - right ;) |
) | ||
|
||
const ( | ||
CONSOLE LogEncoding = iota |
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.
Can we rename it to Console
please? according to standard go naming convention for const
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.
That isn't part of this PR, CONSOLE
and some other constants in utils/log.go
weren't created with this commit. I suggest a separate issue/PR if you want to address that.
This option allows selection of either CONSOLE (the default, and the current behaviour) or JSON for log output, allowing for easier parsing of output for structued log backends.