Documentation
¶
Overview ¶
Package obs is the shared logging facade for internal/* packages (ADR-0003). It lets leaf packages emit log lines and sanitise user input without importing package main. package main wires the sink once at startup (SetSink) so these lines flow into the same rotating/JSON logger; before that, and in unit tests, the default sink writes to stderr.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debugf ¶ added in v1.0.16
Debugf formats with a DEBUG prefix and sends the line to the configured sink, but only while debug logging is enabled (SetDebugEnabled).
func Sanitize ¶
Sanitize strips control characters from s to prevent log injection (CWE-117).
This is an INDEPENDENT copy of package main's sanitizeLog (proxy.go), kept separate on purpose: CodeQL's CWE-117 query recognises the inline strings.ReplaceAll sanitiser at each call site, and delegating across a package boundary risks losing that recognition. The two copies are tiny and each behaviour-tested; the property (no control byte survives) is the contract.
func SetDebugEnabled ¶ added in v1.0.16
func SetDebugEnabled(on bool)
SetDebugEnabled publishes whether debug-level lines should emit. Called by package main's SetLogLevel on every level change.
Types ¶
This section is empty.