Re: [go-nuts] Re: custom slog Handler which adds Attribute and WithGroup

2023-10-23 Thread 'Sean Liao' via golang-nuts
The slog API doesn't allow wrapping handlers this way. slog.Handlers hold state for the current open group. You'll need a full implementation of a handler to do this. (Technically it's possible if you record the group/attrs in With/WithGroup yourself and only call the wrapped handler in Handle, bu

[go-nuts] Re: custom slog Handler which adds Attribute and WithGroup

2023-10-23 Thread Johann Höchtl
As I got zero reply to that answer, let me rephrase it probably more easily: I would like to use slog, no other logging library I would like to have an entry called eventID which is at the root level and has a unique uuid for every log entry I would like to use a group for every application speci