-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
Description
When using wasilog and slog the group attributes are repeated with each log call. This seems to be an issue with how the wasilog is implementing the slog.Handler as the repeated group can not be seen when using the native Go logger (e.g. var handler = slog.Default().Handler().WithAttrs(attr)).
Proof
Add the following code to a new template Go function (wash new).
var attr = []slog.Attr{
slog.String("name", "foo"),
slog.Group("nested", slog.String("bar", "baz")),
}
var handler = wasilog.DefaultOptions().NewHandler().WithAttrs(attr)
var logger = slog.New(handler)
logger.Info("Hello, World 1!")
logger.Info("Hello, World 2!")
logger.Info("Hello, World 3!")When calling the function you get the following logs:
INFO <...> Hello, World 1! name="foo" nested.bar="baz"
INFO <...> Hello, World 2! name="foo" nested.nested.bar="baz"
INFO <...> Hello, World 3! name="foo" nested.nested.nested.bar="baz"
Metadata
Metadata
Assignees
Labels
No labels