WithContext decorates the log.Logger with information form context. If there is an opentracing span in the context, the span will receive the logger output as well.
(logger log.Logger, ctx context.Context)
| 119 | // WithContext decorates the log.Logger with information form context. If there is an opentracing span |
| 120 | // in the context, the span will receive the logger output as well. |
| 121 | func WithContext(logger log.Logger, ctx context.Context) log.Logger { |
| 122 | span := opentracing.SpanFromContext(ctx) |
| 123 | if span == nil { |
| 124 | return WithBaggage(logger, ctx) |
| 125 | } |
| 126 | return WithBaggage(spanLogger{span: span, base: logger}, ctx) |
| 127 | } |
| 128 | |
| 129 | // WithBaggage decorates the log.Logger with information form context. |
| 130 | func WithBaggage(logger log.Logger, ctx context.Context) log.Logger { |