logs

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 6 Imported by: 1

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.

Jump to

Keyboard shortcuts

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