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
logbackend registration; every call (re-)applies the requested max level, so an embedding can callinit_logging()early and later raise the level viainit_logging_at(e.g. the Pythonset_log_levelshim) without losing the override. This is how a caller opts back into the verboseInfo/debug/tracesolver trace that theWarndefault 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-levelflag, the Pythonset_log_levelshim). ReturnsNonefor 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::varis banned crate-wide; see [resolve_log_level]). Returns theLevelFilteractually installed (the default whenspellingis unrecognized, so a typo never silently disables logging). A no-op-safe wrapper overlog::set_max_level.