Thanks to visit codestin.com
Credit goes to Github.com

Skip to content
This repository was archived by the owner on Jun 19, 2025. It is now read-only.

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
@harshavardhana harshavardhana force-pushed the master branch 3 times, most recently from f832434 to 63649d0 Compare May 27, 2025 18:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant