Documentation
¶
Overview ¶
Package log provides structured logging with automatic trace correlation. It integrates slog with OpenTelemetry for unified observability.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Debug logs a message at DEBUG level with optional attributes. Debug logWithContext = noopLogWithContext // Info logs a message at INFO level with optional attributes. Info logWithContext = noopLogWithContext // Warn logs a message at WARN level with optional attributes. Warn logWithContext = noopLogWithContext // Error logs an error at ERROR level with stack trace and optional attributes. Error func(ctx context.Context, err error, attributes ...attribute.Attr) = func(ctx context.Context, err error, attributes ...attribute.Attr) {} )
Functions ¶
func InitLogger ¶
func InitLogger(ctx context.Context, resourceAttrs []attribute.Attr, handler ...slog.Handler) (func(context.Context) error, error)
InitLogger initializes structured logging with optional OTEL export. It sets up the package-level Debug, Info, Warn, and Error functions. Logs automatically include trace_id when within a valid trace context.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.