Skip to main content

Module progress_log

Module progress_log 

Source
Expand description

Stderr progress logger for the gam CLI and the gamfit Python bindings.

Installs a global log backend that timestamps each record (elapsed since process start), strips terminal control / escape sequences, and writes to stderr under a write-lock so concurrent solver threads never interleave partial lines. This is the sole logger bootstrap for the CLI binary and the Python extension module.

(Extracted from the former TUI visualizer module, which has been removed along with its crossterm/ratatui dependencies; only the stderr logging survives — the live chart / progress lanes were non-essential opt-in cruft.)

Functions§

default_log_level
The quiet out-of-the-box verbosity, exposed so callers that want the documented default after an explicit-level path can name it instead of hardcoding Warn.
init_logging
init_logging_at
Install the stderr logger at an explicit verbosity. Idempotent in the sense that the first caller wins the global log backend registration; every call (re-)applies the requested max level, so an embedding can call init_logging() early and later raise the level via init_logging_at (e.g. the Python set_log_level shim) without losing the override. This is how a caller opts back into the verbose Info/debug/trace solver trace that the Warn default suppresses for performance (#1688).
parse_level_directive
Map a caller-supplied verbosity spelling onto a LevelFilter. Wraps the internal [parse_log_level] for out-of-crate callers (the CLI --log-level flag, the Python set_log_level shim). Returns None for blank/unrecognized input so the caller decides the fallback rather than guessing here.
set_log_level
Explicitly set the active log verbosity from a level spelling (off|error|warn|info|debug|trace, case-insensitive). This is the supported way to raise verbosity above the default — callers pass the level they want rather than relying on a process-global env var (std::env::var is banned crate-wide; see [resolve_log_level]). Returns the LevelFilter actually installed (the default when spelling is unrecognized, so a typo never silently disables logging). A no-op-safe wrapper over log::set_max_level.