Help us shape the future of Go! Take the 2026 Go Developer Survey

spanlogger

package
v3.7.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SpanLogger

type SpanLogger = spanlogger.SpanLogger

SpanLogger unifies tracing and logging, to reduce repetition.

func FromContext

func FromContext(ctx context.Context, fallback log.Logger) *SpanLogger

FromContext returns a span logger using the current parent span. If there is no parent span, the SpanLogger will only log to the logger within the context. If the context doesn't have a logger, the fallback logger is used.

func NewOTel added in v3.6.0

func NewOTel(ctx context.Context, logger log.Logger, tracer trace.Tracer, method string, kvps ...interface{}) (*SpanLogger, context.Context)

NewOTel makes a new OTel SpanLogger with a log.Logger to send logs to. The provided context will have the logger attached to it and can be retrieved with FromContext.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL