We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi, and thanks for making zerolog. Maybe I'm missing something, but I fail to make zerolog work with a custom JSON encoder. This is my code:
zerolog
zerolog.InterfaceMarshalFunc = func(v any) ([]byte, error) { fmt.Print("hello") return json.MarshalIndent(v, "", strings.Repeat(" ", 4)) } log.Info().Msg("world")
I would expect zerolog to call my custom InterfaceMarshalFunc to marshal the JSON output (and print hello in the process), but all I get is this:
InterfaceMarshalFunc
hello
{"level":"info","message":"world"}
Am I missing something, or is this a bug?
The text was updated successfully, but these errors were encountered:
This marshaler is only called when the Interface method is used for a given field. Zerolog does not provide a general pluggable marshaler.
Interface
Sorry, something went wrong.
alright, thanks for clarifying!
No branches or pull requests
Description
Hi, and thanks for making
zerolog
. Maybe I'm missing something, but I fail to makezerolog
work with a custom JSON encoder. This is my code:I would expect
zerolog
to call my customInterfaceMarshalFunc
to marshal the JSON output (and printhello
in the process), but all I get is this:Am I missing something, or is this a bug?
The text was updated successfully, but these errors were encountered: