-
Notifications
You must be signed in to change notification settings - Fork 22
Make Named
work with nested loggers
#92
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
Comments
Can you clarify here with a small example? I'm not sure how The implementation is dead simple, see https://github.com/cdr/slog/blob/5519752b31c469cf4e04c220ec381eea4341f953/slog.go#L129 |
Ah, so I'd say this is more of a confusion I have with the func TestNestedNamed(t *testing.T) {
t.Parallel()
s1 := &fakeSink{}
s2 := &fakeSink{}
l := slog.Make(s1).Named("s1")
l = slog.Make(l, s2).Named("s2")
l.Info(bg, "")
// passes
assert.Len(t, "s1 has 2 names", 2, s1.entries[0].LoggerNames)
// fails
assert.Len(t, "s2 has 2 names", 2, s2.entries[0].LoggerNames)
} This "append" operation is essentially what |
Maybe something like |
Ah, I see what you mean. Yea unfortunately, you have to use Can you do that in this case? If so, I'm thinking we forgo |
Similar to the issue with nested loggers not respecting
Leveled
, the same problem exists forNamed
.The text was updated successfully, but these errors were encountered: