UpdateContext updates the existing logging context in the context. IMPORTANT: No new context is created, all future logs with provided context will be impacted.
(ctx context.Context, opts ...Option)
| 27 | // UpdateContext updates the existing logging context in the context. |
| 28 | // IMPORTANT: No new context is created, all future logs with provided context will be impacted. |
| 29 | func UpdateContext(ctx context.Context, opts ...Option) { |
| 30 | // updates existing logging context in provided context.Context |
| 31 | zerolog.Ctx(ctx).UpdateContext(func(c zerolog.Context) zerolog.Context { |
| 32 | for _, opt := range opts { |
| 33 | c = opt(c) |
| 34 | } |
| 35 | |
| 36 | return c |
| 37 | }) |
| 38 | } |
| 39 | |
| 40 | // NewContext derives a new LoggingContext from the existing LoggingContext, adds the provided annotations, |
| 41 | // and then returns a clone of the provided context.Context with the new LoggingContext. |
no outgoing calls
no test coverage detected
searching dependent graphs…