Skip to main content

Module logging

Module logging 

Source
Expand description

Runtime log-level gate for the log_* macros.

Levels, low → high: TRACE < DEBUG < INFO < WARN < ERROR < OFF. A message at level L prints iff L >= threshold. Default is WARN (warnings + errors), overridable at launch via VECTOR_LOG=trace|debug|info|warn|error|off or at runtime via set_log_level. log_info!/log_debug!/log_trace! remain compiled out entirely in release; the gate only narrows the dev firehose.

Constants§

LEVEL_DEBUG
LEVEL_ERROR
LEVEL_INFO
LEVEL_OFF
LEVEL_TRACE
LEVEL_WARN

Functions§

format_unix_utc
Civil date from unix seconds (Howard Hinnant’s civil_from_days).
level_enabled
Whether a message at level should print under the active threshold.
log_level
Active threshold, initialising from VECTOR_LOG on first read (benign race: concurrent initialisers all compute the same value).
persist
Route a pre-formatted line to the persistent log, if a sink is registered.
set_log_level
Override the threshold at runtime (e.g. a settings toggle).
set_log_level_str
Set the threshold by name (trace|debug|info|warn|error|off); returns false on an unknown name.
set_persist_sink
Register the shell’s persistent-log writer. First registration wins.
timestamp_utc
YYYY-MM-DD HH:MM:SSZ for the current instant, dependency-free (no chrono in the tree). A bare clock time can’t tell a support-log reader whether an error predates a fix — the date is the whole point of a persistent log.