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

Supporting log overrides/log markers with log levels #1295

Open
aayush19saxena opened this issue Jun 29, 2023 · 3 comments
Open

Supporting log overrides/log markers with log levels #1295

aayush19saxena opened this issue Jun 29, 2023 · 3 comments

Comments

@aayush19saxena
Copy link

aayush19saxena commented Jun 29, 2023

Is your feature request related to a problem? Please describe.
I would like to log at debug levels when the logger encounters a specific identifier. Say I want to log at trace levels when the user_id is 123
Describe the solution you'd like
it would be nice if we can configure the logger at the time of initialization to look for certain identifiers. I am really new to Go so can't suggest a solution right off the bat but in Java i used to use logging filters. An example- https://logging.apache.org/log4j/2.0/manual/filters.html

Describe alternatives you've considered
N/A

Is this a breaking change?
We do not accept breaking changes to the existing API. Please consider if your proposed solution is backwards compatible. If not, we can help you make it backwards compatible, but this must be considered when we consider new features.

N/A
Additional context
Add any other context or screenshots about the feature request here.

@SoulPancake
Copy link

@aayush19saxena Is your request similar to this

@aayush19saxena
Copy link
Author

@aayush19saxena Is your request similar to this

No, i'd like to keep the same log levels. I just want the logger to use debug level when it encounters an "identifier" in it's configuration.

@sywhang
Copy link
Contributor

sywhang commented Jul 5, 2023

I'm not sure if this is a feature that makes sense for you to build into the Zap logger - it can be implemented by additional wrapper layer that has the logic for filtering. My concern here is that the room for what "matches" the filter is going to be fairly extensive, and designing an appropriate API for that is challenging.

Open to discussing the feature if enough people need this feature though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants