Documentation
¶
Overview ¶
Package logging owns the controller's root logger construction: a single zap.Logger (Init, guarded by sync.Once so repeated calls are safe and always return the same instance) wrapped as a logr.Logger (AsLogr) for controller-runtime's consumption.
Config selects which sinks feed that logger — console, a rotated local file, and/or Papertrail/SolarWinds over syslog — and buildZap (zap.go) wires them together as a zapcore.Tee. Papertrail connection failure is deliberately non-fatal (buildPapertrailCore logs to stderr and returns nil rather than erroring): losing a remote log sink shouldn't crash the controller.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Init ¶
Init builds the root zap logger from cfg on first call and returns it (wrapped as logr.Logger) plus the underlying *zap.Logger. Subsequent calls return the same root logger regardless of cfg.
func SetupPapertrailJSONIngest ¶
SetupPapertrailJSONIngest returns a function that sends JSON logs directly to Papertrail / SolarWinds HTTP ingestion API.
This is intentionally decoupled from zap: - no global logger - no side effects - safe to use from controllers, jobs, or goroutines
Types ¶
type Config ¶
type Config struct {
Development bool
Console bool
File bool
FilePath string
Level string // "debug", "info", "warn", "error"
EnablePapertrail bool
PapertrailAddr string
PapertrailTag string
}
Config configures the root logger's output (console/file/Papertrail) and verbosity.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a development-mode Config: console output only, info level, no file or Papertrail sink.