| 258 | } |
| 259 | |
| 260 | func (e *ExtraLogFields) getSloggerHandler(handler *extraFieldsSlogHandler) (h slog.Handler) { |
| 261 | if existing, ok := e.handlers.Load(handler); ok { |
| 262 | return existing.(slog.Handler) |
| 263 | } |
| 264 | |
| 265 | if handler.moduleID == "" { |
| 266 | h = zapslog.NewHandler(handler.core.With(e.fields)) |
| 267 | } else { |
| 268 | h = zapslog.NewHandler(handler.core.With(e.fields), zapslog.WithName(handler.moduleID)) |
| 269 | } |
| 270 | |
| 271 | if handler.group != "" { |
| 272 | h = h.WithGroup(handler.group) |
| 273 | } |
| 274 | if handler.attrs != nil { |
| 275 | h = h.WithAttrs(handler.attrs) |
| 276 | } |
| 277 | |
| 278 | e.handlers.Store(handler, h) |
| 279 | |
| 280 | return h |
| 281 | } |
| 282 | |
| 283 | const ( |
| 284 | // Variable name used to indicate that this request |