Documentation
¶
Overview ¶
Package logs builds an OpenTelemetry LoggerProvider that batches log records to the exporter in a resolved otelcore.Settings, and an slog.Handler bridge so an application's slog logger can emit OTel records alongside its usual output. Records logged with a context inside an active span carry its trace and span IDs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handler ¶
func Handler(lp *sdklog.LoggerProvider, name string) slog.Handler
Handler returns an slog.Handler that emits OTel log records through lp. name is the instrumentation scope. Feed it to logger.NewSlog, or tee it beside the stderr handler, to ship the application's logs to the collector.
func NewProvider ¶
func NewProvider( ctx context.Context, res *resource.Resource, s otelcore.Settings, ) (*sdklog.LoggerProvider, error)
NewProvider builds a LoggerProvider that batches log records to s.Exporter. A nil s.Exporter means otelcore.Collector{}, which reads the standard OTEL_EXPORTER_OTLP_* environment variables. The caller owns the returned provider's Shutdown — typically registered on the controls.Controller.
Types ¶
This section is empty.