package slogtraces
Import Path
go.pact.im/x/traces/slogtraces (on go.dev)
Dependency Relation
imports 3 packages, and imported by one package
Involved Source Files
Package slogtraces provides [slog] trace correlation helpers for
[traces.SpanRef].
Package-Level Type Names (only one, which is unexported)
Package-Level Functions (total 3, all are exported)
Attr returns a [slog.Attr] for ref under key. If key is empty, slog inlines
trace_id, span_id, and trace_flags as top-level attributes.
Value returns a [slog.Value] group containing trace_id, span_id, and
trace_flags when ref is valid, or an empty group otherwise.
WrapHandler wraps h so that every log record emitted with a context carrying
a valid [traces.SpanRef] (via [traces.NewContext]) includes [Attr] for that
span reference under key.
If key is non-empty, fields are nested under a group with that key (for
example "trace"). If key is empty, trace_id, span_id, and trace_flags are
added as top-level attributes.
Package-Level Constants (total 5, none are exported)
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64)