Warn outputs an WARN-level log message to the logger configured in the supplied context.
(ctx context.Context, format string, args ...any)
| 33 | // Warn outputs an WARN-level log message to the logger configured in the |
| 34 | // supplied context. |
| 35 | func Warn(ctx context.Context, format string, args ...any) { |
| 36 | logger := config.Logger(ctx) |
| 37 | if logger == nil || !logger.Enabled(ctx, slog.LevelWarn) { |
| 38 | return |
| 39 | } |
| 40 | var stack [1]uintptr |
| 41 | runtime.Callers(2, stack[:]) // skip [Callers, Warn] |
| 42 | r := slog.NewRecord(time.Now(), slog.LevelWarn, strings.TrimSpace(fmt.Sprintf(format, args...)), stack[0]) |
| 43 | _ = logger.Handler().Handle(ctx, r) |
| 44 | } |
| 45 | |
| 46 | // Debug outputs an DEBUG-level log message to the logger configured in the |
| 47 | // supplied context. |
no test coverage detected
searching dependent graphs…