Skip to content
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

logging: support JSON output in the default logger #507

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

derSascha
Copy link
Contributor

It would be great if the default logger supports structured JSON output, to process the logs with common log collectors. The slog logging framework supports this out of the box 🎉

This pull-request adds a new format option to the log section of the configuration file, that supports text and JSON based output in the default logger. The text format will be used if no format was specified, making the option backward compatible.

Example config looks like this:

log:
  format: JSON
  error: INFO
  audit: INFO
...

The implementation adds a new LogFormat type and forwards the value to the server. This affects only the default audit and error logger that are logging to STDOUT/STDERR.

What do you think about such feature? Any suggestions are welcome.

Add a new "format" option to the log section of the configuration file,
that supports text and JSON based output in the default logger. The text format
will be used if no format was specified, making the option backward compatible.

Signed-off-by: Sascha Wolke <[email protected]>
@derSascha derSascha force-pushed the support-json-log-output branch from e0f3497 to f189c28 Compare January 30, 2025 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant