You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am banging my head in this seemingly easy and as I think not unreasonable issue.
I would like to create a new slog handler which adds a field eventID with an outomatically added UUID
Achieved, writing custom handler type an custom Handler which adds a new field. Alternatively some trickery with ReplaceAttr also get's me there, Handler is cleaner though.
I would like to add further logging attributes into a group "custom", therefore I call myslogderivedlogger.WithGroup("custom").
Here it get's funny though, as the field eventid is now added as custom.eventID instead at the "root" level, at the root level there is no more eventId
Would your slog middleware help me in getting there?
The text was updated successfully, but these errors were encountered:
the42
changed the title
handler which adds eventid but doesn't when called Withgroup
handler which adds eventid always at root level, not within a WithGroup
Oct 24, 2023
Samuel Berthe ***@***.***> schrieb am Sa., 11. Mai 2024,
22:54:
did you write
myslogderivedlogger.WithGroup("custom")
or
myslogderivedlogger = myslogderivedlogger.WithGroup("custom")
I used this second form as according to the doc, the logger is not altered
I am banging my head in this seemingly easy and as I think not unreasonable issue.
I would like to create a new slog handler which adds a field eventID with an outomatically added UUID
Achieved, writing custom handler type an custom Handler which adds a new field. Alternatively some trickery with ReplaceAttr also get's me there, Handler is cleaner though.
I would like to add further logging attributes into a group "custom", therefore I call myslogderivedlogger.WithGroup("custom").
Here it get's funny though, as the field eventid is now added as custom.eventID instead at the "root" level, at the root level there is no more eventId
Would your slog middleware help me in getting there?
The text was updated successfully, but these errors were encountered: