Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewContextWithLogger ¶
func NewContextWithLogger( ctx context.Context, cfg config.Config, otelLoggerProvider *log.LoggerProvider, ) context.Context
NewContextWithLogger creates a new context with a configured logger. If otelLoggerProvider is provided, logs will be sent to both local output and OTel collector. If otelLoggerProvider is nil, only local logging is configured (useful for tests and local dev without OTel).
func NewLoggerProvider ¶ added in v0.2.0
func NewLoggerProvider( ctx context.Context, opts telemetry.Options, ) (*log.LoggerProvider, telemetry.ShutdownFunc, error)
NewLoggerProvider creates and configures a new OpenTelemetry LoggerProvider with OTLP HTTP exporter. Returns the logger provider, a shutdown function that should be called when the application exits, and an error if initialization fails.
The logger provider is automatically set as the global provider and can be used with otelslog bridge.
Types ¶
type MultiHandler ¶ added in v0.2.0
type MultiHandler struct {
// contains filtered or unexported fields
}
MultiHandler forwards log records to multiple handlers. This allows logs to be sent to both local output (stdout/prettylog) and OTel collector.
func NewMultiHandler ¶ added in v0.2.0
func NewMultiHandler(handlers ...slog.Handler) *MultiHandler
NewMultiHandler creates a new MultiHandler that forwards records to all provided handlers.
func (*MultiHandler) Enabled ¶ added in v0.2.0
Enabled returns true if any of the handlers are enabled for the given level.