PanicfCtx logs the given formatted string and args to the error log level and given log key and then panics.
(ctx context.Context, format string, args ...any)
| 131 | |
| 132 | // PanicfCtx logs the given formatted string and args to the error log level and given log key and then panics. |
| 133 | func PanicfCtx(ctx context.Context, format string, args ...any) { |
| 134 | // Fall back to stdlib's log.Panicf if SG loggers aren't set up. |
| 135 | if errorLogger.Load() == nil { |
| 136 | log.Panicf(format, args...) |
| 137 | } |
| 138 | // ensure the log message always reaches console |
| 139 | ConsolefCtx(ctx, LevelError, KeyAll, format, args...) |
| 140 | FlushLogBuffers() |
| 141 | panic(fmt.Sprintf(format, args...)) |
| 142 | } |
| 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) { |
no test coverage detected