-
Notifications
You must be signed in to change notification settings - Fork 575
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
Customizing order of fields #446
Comments
I think it's hard in zerolog because its console writer unmarshal input to map[string]interface{}. I re-wrote a zerolog-like logger and a new console writer, the example for your requirement is here https://go.dev/play/p/UmJmLxYXwRO |
The same request |
This is definitely a bug and should be addressed. |
To avoid printing fields twice, configure It would be really useful if the function |
I want to be able to customize the order of fields, instead of having it sorted alphabetically.
Using
PartsOrder
to customize the order works, but it displays NIL for logs that don't have that field.Also, the field gets printed twice.
How would I be able to do this?
If not possible, suggested change:
FormatWriteFields FieldsFormatter
withtype func FieldsFormatter (evt map[string]interface{}, buf *bytes.Buffer)
that users can pass in (similar to the other formatters)zerolog/console.go
Line 129 in 263b0bd
The text was updated successfully, but these errors were encountered: