log

package
v0.0.0-...-c46dd35 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package log provides structured logging configuration for Aether components.

Logging is built on the standard library's log/slog. Records are emitted as JSON to stderr (parsed via kubectl logs) and, when an OTLP handler is supplied, fanned out to the OpenTelemetry logs bridge as well. slog's context-aware Handle is what lets the otelslog bridge populate trace_id/span_id natively from the ctx passed to the *Context log methods.

Log levels can be controlled via the debug flag:

  • debug=false: Info level (default production setting)
  • debug=true: Trace level (enables the V(1)/V(2)-equivalent debug output)

Index

Constants

View Source
const LevelTrace slog.Level = -8

LevelTrace is the most verbose level, mapping the old logr V(2) calls. logr V(1) maps to slog.LevelDebug (-4); V(2) needs something lower.

Variables

This section is empty.

Functions

func Named

func Named(l *slog.Logger, name string) *slog.Logger

Named returns a child logger tagged with a component name under the "logger" field, replacing logr's WithName. Naming is hierarchical and dot-joined (e.g. "aether-agent" then "cache" -> "aether-agent.cache"), and always emits a single "logger" key — unlike a plain With(loggerKey, …), which would append a second "logger" attribute on every re-name and produce duplicate JSON keys.

func NewLogger

func NewLogger(debug bool) *slog.Logger

NewLogger creates a structured logger writing JSON to stderr.

func NewLoggerWithHandler

func NewLoggerWithHandler(debug bool, extra slog.Handler) *slog.Logger

NewLoggerWithHandler is like NewLogger but, when extra is non-nil, fans every record out to that additional handler (the otelslog OTLP bridge) in addition to the stderr JSON sink. The extra sink inherits the same level threshold so both outputs stay consistent.

Types

This section is empty.

Jump to

Keyboard shortcuts

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