MCPcopy Index your code
hub / github.com/coder/slog / With

Function With

slog.go:265–269  ·  view source on GitHub ↗

With returns a context that contains the given fields. Any logs written with the provided context will have the given logs prepended. It will append to any fields already in ctx.

(ctx context.Context, fields ...Field)

Source from the content-addressed store, hash-verified

263//
264// It will append to any fields already in ctx.
265func With(ctx context.Context, fields ...Field) context.Context {
266 f1 := fieldsFromContext(ctx)
267 f2 := f1.append(fields)
268 return fieldsWithContext(ctx, f2)
269}
270
271// SinkEntry represents the structure of a log entry.
272// It is the argument to the sink when logging.

Callers

nothing calls this directly

Calls 3

fieldsFromContextFunction · 0.85
fieldsWithContextFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected