Logger returns the appropriate logger for current context
(ctx context.Context)
| 12 | |
| 13 | // Logger returns the appropriate logger for current context |
| 14 | func Logger(ctx context.Context) logrus.FieldLogger { |
| 15 | val := ctx.Value(loggerContextKeyVal) |
| 16 | if val != nil { |
| 17 | if logger, ok := val.(logrus.FieldLogger); ok { |
| 18 | return logger |
| 19 | } |
| 20 | } |
| 21 | return logrus.StandardLogger() |
| 22 | } |
| 23 | |
| 24 | // WithLogger adds a value to the context for the logger |
| 25 | func WithLogger(ctx context.Context, logger logrus.FieldLogger) context.Context { |
no outgoing calls
searching dependent graphs…