LoggerFromContext returns a logger attached to a context.
(ctx context.Context)
| 19 | |
| 20 | // LoggerFromContext returns a logger attached to a context. |
| 21 | func LoggerFromContext(ctx context.Context) (*Logger, bool) { |
| 22 | if ctx == nil { |
| 23 | return nil, false |
| 24 | } |
| 25 | log, ok := ctx.Value(contextKey{}).(*Logger) |
| 26 | return log, ok && log != nil |
| 27 | } |
searching dependent graphs…