-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Change LogLevel without creating a new core #774
Comments
This is possible to do using I've provided an example here: Given similar requests (#763), I think maybe we should include something as part of zap to simplify this, but would have to make it very clear that it can only ever be used to increase the log level (e.g., decrease the number of logs that would be logged). I've created a WIP PR: #775 |
We've had a few requests on how to change the level of a logger. With the current APIs, it's not possible to reduce the log level (e.g., go from Info to Debug), but it is possible to increase the level using `WrapCore` with a custom filtering core. Since it's a common request, I think we should add an option to make this easy to use. I want to make sure "increase" is part of the API to avoid confusion on whether it can reduce the log level. Fixes #774.
We've had a few requests on how to change the level of a logger. With the current APIs, it's not possible to reduce the log level (e.g., go from Info to Debug), but it is possible to increase the level using `WrapCore` with a custom filtering core. Since it's a common request, I think we should add an option to make this easy to use. I want to make sure "increase" is part of the API to avoid confusion on whether it can reduce the log level. Fixes #774.
We've had a few requests on how to change the level of a logger. With the current APIs, it's not possible to reduce the log level (e.g., go from Info to Debug), but it is possible to increase the level using `WrapCore` with a custom filtering core. Since it's a common request, I think we should add an option to make this easy to use. I want to make sure "increase" is part of the API to avoid confusion on whether it can reduce the log level. Fixes #774.
We've had a few requests on how to change the level of a logger. With the current APIs, it's not possible to reduce the log level (e.g., go from Info to Debug), but it is possible to increase the level using `WrapCore` with a custom filtering core. Since it's a common request, I think we should add an option to make this easy to use. I want to make sure "increase" is part of the API to avoid confusion on whether it can reduce the log level. Fixes uber-go#774.
I'd like to create a new subLogger which only logs messages at the
WarnLevel
instead of theInfoLevel
(which is desired for the rest of the application). I read the other issues about doing so, but they implied creating a new zapcore.I do not want to create a new zapcore for my sublogger, because my logger's core has hooks which should still be used for the sublogger. So is there any way to create a sublogger which reuses my existent zapcore but only emits log messages at the WarnLevel+?
The text was updated successfully, but these errors were encountered: