(v any)
| 397 | } |
| 398 | |
| 399 | func 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 | } |