MCPcopy
hub / github.com/caddyserver/caddy / Set

Method Set

modules/caddyhttp/logging.go:248–258  ·  view source on GitHub ↗

Set sets a field in the list of extra fields to log. If the field already exists, it is replaced.

(field zap.Field)

Source from the content-addressed store, hash-verified

246// Set sets a field in the list of extra fields to log.
247// If the field already exists, it is replaced.
248func (e *ExtraLogFields) Set(field zap.Field) {
249 e.handlers.Clear()
250
251 for i := range e.fields {
252 if e.fields[i].Key == field.Key {
253 e.fields[i] = field
254 return
255 }
256 }
257 e.fields = append(e.fields, field)
258}
259
260func (e *ExtraLogFields) getSloggerHandler(handler *extraFieldsSlogHandler) (h slog.Handler) {
261 if existing, ok := e.handlers.Load(handler); ok {

Calls

no outgoing calls