-
Notifications
You must be signed in to change notification settings - Fork 78
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
Confused with the slogr level #306
Comments
I'm not sure I am following. Are you trying to configure a logr backend so that it prints slog That is indeed not possible because the level range from logr is more limited than the one from slog. slog supports levels that go towards negative infinity (= less important) and towards positive infinity (= more important). logr only has "less important than info/error". |
Let me detail my case more, when I am logging, I have the following choices:
when doing Debug logs, the In the slogr case I read, It matches the following levels:
I can only use 1-4 for other levels logging, |
I have tried locally and believed that I found the correct usage. we should pass the level to slog using
just like this, if I set the level=-4:
is that right? if this is the correct usage, it may be worth raising a PR to add an example and docs, and I am glad to help |
I'm getting lost when you say A PR with example and docs might help to clarify, so yes, please create one. |
as from the comment:
logr/slogr.go
Lines 55 to 58 in 26eb1a2
it seems that we have only
0-4
that could be used as non-error levels, and0
as the default(log.Info()
withoutV()
).this makes all the non-error as default printed levels, which leads to printing all
Debug
levels.if I increase the level to
1-4
, I will lose all the default Info() level logs.this really confused me, may I ask how you use the level to switch different level detailed logs?
The text was updated successfully, but these errors were encountered: