Documentation
¶
Overview ¶
Package logs builds an OpenTelemetry LoggerProvider that batches log records to an OTLP/HTTP collector, and an slog.Handler bridge so the GTB logger can emit OTel records as well as its human-readable stderr output. It is one of the GTB observability signals.
Trace correlation: records emitted within an active span carry trace_id and span_id automatically when logged through a context-aware path. GTB's request access logs are correlated by the transport logging middleware/interceptor, which injects those fields from the request context — so correlation reaches both the stderr sink and the OTLP records here.
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 the OTLP/HTTP collector described by s. When s.Endpoint is empty the exporter falls back to 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.