1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//! The `st` CLI's logger: reproduces syntext's historical stderr format.
//!
//! The library emits diagnostics through the `log` facade (`log::warn!` /
//! `log::debug!`); this installs the only logger that turns those into stderr
//! lines. A library embedder that never calls [`init`] gets total silence,
//! since `log` macros with no logger installed are a couple of atomic loads.
//!
//! # Level mapping (behaviour-preserving)
//!
//! Historically the library printed a message iff it was unconditional
//! (`warn!` here) OR it was a `config.verbose`-gated diagnostic (`debug!` here)
//! and verbose was on. That maps exactly onto two log levels with no `info`
//! tier:
//!
//! - not verbose → `Warn`: only the old unconditional messages surface.
//! - verbose (`-v`/`--debug`, or `st index` without `--quiet`) → `Debug`: the
//! old per-file skips, build summary, and calibration lines surface too.
//!
//! Output format matches the old `eprintln!`s: `st: <message>`, no timestamp,
//! module path, or level tag (scripts/tests parsing stderr keep working).
use ;
;
static LOGGER: StderrLogger = StderrLogger;
/// Install the CLI logger and set its level from the resolved `verbose` flag.
///
/// Idempotent: `set_logger` failing on a second call (e.g. in tests that run
/// `cli::run` more than once in-process) is ignored; the level is still
/// updated. Call once, first thing in `cli::run`.
pub
/// Adjust the log level after a subcommand has resolved its own verbose state
/// (e.g. `st index` defaults to verbose, `--quiet` forces it off). Cheap: a
/// single atomic store, so re-deriving it per subcommand is fine.
pub