MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / toSlogValue

Function toSlogValue

options/options.go:399–417  ·  view source on GitHub ↗
(v any)

Source from the content-addressed store, hash-verified

397}
398
399func toSlogValue(v any) slog.Value {
400 m, ok := v.(map[string]any)
401 if !ok {
402 return slog.AnyValue(v)
403 }
404
405 attrs := make([]slog.Attr, 0, len(m))
406
407 for k, v := range m {
408 attrs = append(attrs, slog.Attr{Key: k, Value: toSlogValue(v)})
409 }
410
411 // Sort attributes by key to have a consistent order
412 slices.SortFunc(attrs, func(a, b slog.Attr) int {
413 return strings.Compare(a.Key, b.Key)
414 })
415
416 return slog.GroupValue(attrs...)
417}

Callers 1

LogValueMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected