FatalfCtx logs the given formatted string and args to the error log level and given log key and then exits.
(ctx context.Context, format string, args ...any)
| 143 | |
| 144 | // FatalfCtx logs the given formatted string and args to the error log level and given log key and then exits. |
| 145 | func FatalfCtx(ctx context.Context, format string, args ...any) { |
| 146 | // no-op call to enable golang.org/x/tools/go/analysis/passes/printf checking in go vet |
| 147 | if false { |
| 148 | _ = fmt.Sprintf(format, args...) |
| 149 | } |
| 150 | // Fall back to stdlib's log.Panicf if SG loggers aren't set up. |
| 151 | if errorLogger.Load() == nil { |
| 152 | log.Fatalf(format, args...) |
| 153 | } |
| 154 | // ensure the log message always reaches console |
| 155 | ConsolefCtx(ctx, LevelError, KeyAll, format, args...) |
| 156 | FlushLogBuffers() |
| 157 | os.Exit(1) |
| 158 | } |
| 159 | |
| 160 | // ErrorfCtx logs the given formatted string and args to the error log level and given log key. |
| 161 | func ErrorfCtx(ctx context.Context, format string, args ...any) { |
no test coverage detected