Skip to main content

Module logging

Module logging 

Source
Expand description

File-based diagnostic logging (~/.vct/logs/vct-YYYY-MM-DD.log).

Keeps the standard log facade — every existing log::warn! / error! in the crate is unchanged — but swaps the output backend for a small file logger. Records land in a plain-text daily file under ~/.vct/logs, never on stdout/stderr, so the interactive TUI is never corrupted. The file is created lazily on the first record, so a command that logs nothing (e.g. a successful vct version) leaves ~/.vct untouched.

init installs the logger (default level warn). Terminal-restore-on-panic is a presentation concern, so the CLI binary installs that hook separately. apply later reconfigures the level from [logging] in the user config and prunes stale files.

Functions§

apply
Applies the persisted [logging] settings: sets the max level and prunes stale daily files. Called after the user config is loaded (usage / analysis).
init
Installs the global file logger at the default level (warn).