From retrieves the logger from the context or panics if no logger is found
(ctx context.Context)
| 18 | |
| 19 | // From retrieves the logger from the context or panics if no logger is found |
| 20 | func From(ctx context.Context) *slog.Logger { |
| 21 | if logger, ok := ctx.Value(loggerKey).(*slog.Logger); ok { |
| 22 | return logger |
| 23 | } |
| 24 | panic("no logger found in context") |
| 25 | } |
| 26 | |
| 27 | // plucked from log/slog |
| 28 | // remove once we update to go 1.24 |
no outgoing calls
no test coverage detected