-
Notifications
You must be signed in to change notification settings - Fork 10
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
Cannot log with verbosity > 2 #20
Comments
@byatesrae When using with logr, it is preferrable to avoid calling zerolog.SetGlobalLevel() and use logr.V() instead, so it is safe to use many packages depending on logr. Currently, logr.V() only supports level addition. |
Thanks @hn8, use of Here's a simplified example:
Expected output:
Actual output:
|
@byatesrae zerologr's log level range is limited by underlying implementation of zerolog and logr. zerolog only supports these levels: https://github.com/rs/zerolog#leveled-logging. And logr's philosophy removes warn/fatal/panic. So there are only 3 available logr levels: 0 for info, 1 for debug, 2 for trace and separate error level. |
@hn8 I think I see where you're coming from. Although, it may just be me but it doesn't seem obvious from zerologr's Out of curiosity, given the logr philosophy on logging is that only |
Our project uses zerolog as the primary logger, and a library we're using uses logr instead. We want to keep all configuration in zerolog, however we are unable to get debug logs out of the library because of this limitation. What is the suggested workaround in this case? |
@ajanata you can still get Zerolog to print |
I will make a PR to document that Zerolog is limited to printing up to V(2) verbosity. |
@ajanata In zerolog, using levels more verbose than TraceLevel is an undocumented feature. Would you please share what value you pass into zerolog.SetGlobalLevel() and logr.V()? Or do you pass in zerolog.Logger with different level in zelologr.New()? |
@tonglil undocumented zerolog levels do not support LevelSampler and LevelHook, and likely never will since they are struct. zapr may be the better choice than zerologr if higher verbosity is needed. |
The whole point of https://github.com/rs/zerolog/pull/350/files was to allow higher V levels. If zerologr can't make that work, it's not really a very useful logr implementation, IMO. |
It is possible but not enabled by default in new PR. Explained here #25 (comment) |
Apologies, I suppose I should open a bug with opentelemetry-go, since they use |
@ajanata You can now use SetMaxV to adjust global level of Zerolog in zerologr v1.2.3. |
When logging at a verbosity > 2 no log messages appear, despite configuring zerolog's minimum accepted level.
I can see logging is short circuited here but I'm not sure why given logr's philosophy seems to imply we choose verbosity based on the applications needs.
Go playground.
Expected output:
Actual output:
The text was updated successfully, but these errors were encountered: