Documentation
¶
Overview ¶
Package logger configures structured logging for the agent using log/slog.
Design decisions:
- JSON output by default for log aggregation (journald, Loki, Datadog)
- Text output when LOG_FORMAT=text (local development)
- Level controlled by LOG_LEVEL env var (debug, info, warn, error)
- Structured fields: environment, phase, digest, duration included consistently
Index ¶
Constants ¶
View Source
const ( PhasePoll = "poll" PhaseDrift = "drift_check" PhasePull = "image_pull" PhaseStrategy = "deployment_strategy" PhaseMigration = "migration" PhaseRestart = "restart" PhaseHealthCheck = "health_check" PhaseCommit = "commit" PhaseRollback = "rollback" PhaseNoop = "noop" )
Phase constants for structured log fields. Using constants prevents typos and enables log-based alerting rules.
Variables ¶
This section is empty.
Functions ¶
func FromContext ¶
FromContext retrieves the logger stored in ctx. Falls back to the default slog logger if none is stored.
func Setup ¶
Setup configures the default global slog logger. Call once at startup before spawning goroutines.
func WithContainerName ¶
WithContainerName returns a child logger with the environment field pre-set. All log lines emitted from the reconciler for an environment will carry this.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.