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

Make it possible to exclude fields from console log #411

Closed
choover-broad opened this issue Feb 14, 2022 · 2 comments
Closed

Make it possible to exclude fields from console log #411

choover-broad opened this issue Feb 14, 2022 · 2 comments

Comments

@choover-broad
Copy link
Contributor

choover-broad commented Feb 14, 2022

Hello! Thanks for all the great work on zerolog, it's been a pleasure to use.

We are using zerolog in a CLI tool with two writers, one to the console at info level and another to a file at debug level, using the solution described here.

We would like to add some additional context fields to all messages for debugging (for example, process id to distinguish between separate invocations of the tool), but don't want to include those fields in the console log because they add clutter.

I see there are already PartsExclude and PartsOrder options in the console logger for excluding some default fields. Would you be open to a PR for new options, FieldsExclude and FieldsOrder, that do the same thing but for contextual fields?

If there is a better way to accomplish what we are after, that works too!

@mitar
Copy link
Contributor

mitar commented Mar 14, 2022

Oh, I hoped that #411 also added FieldsOrder. It would be nice if we could customize which fields are prioritized and pulled to the front (with default being error). Then for HTTP requests I could pull path and method to the front.

pablitoc pushed a commit to nxcr-org/zerolog that referenced this issue Apr 7, 2023
@mitar
Copy link
Contributor

mitar commented Aug 18, 2023

This has been merged.

@rs rs closed this as completed Aug 18, 2023
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

No branches or pull requests

3 participants