logging

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package logging builds slog handlers from validated operator logging config.

OpenTelemetry: WithOTELTraceAttrs enables [otelTraceFieldsHandler], which copies trace_id and span_id from the span in context onto each slog record. We do not use go.opentelemetry.io/contrib/bridges/otelslog: that bridge overlaps the same correlation and would risk duplicate fields if combined with this handler, without adding a capability we need today (see otelslog module docs vs. our minimal JSON/text wiring).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger

func NewLogger(cfg config.LoggingConfig, w io.Writer, opts ...Option) (*slog.Logger, error)

NewLogger builds a slog.Logger from validated config.LoggingConfig using a slog-multi Pipe with slog-formatter error normalization over JSON or text output.

Types

type Option

type Option func(*loggerSettings)

Option configures NewLogger.

func WithOTELTraceAttrs

func WithOTELTraceAttrs(enabled bool) Option

WithOTELTraceAttrs wraps the handler so each record includes trace_id and span_id from the OpenTelemetry span in context when tracing is enabled.

This is the supported integration point for log–trace correlation in lipstd; do not stack go.opentelemetry.io/contrib/bridges/otelslog on the same handler without removing this option.

Jump to

Keyboard shortcuts

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