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
use io;
use IsTerminal;
use PathBuf;
use Parser;
/// Level directives applied when the operator sets no `RUST_LOG`.
///
/// The server's own crates run at `info` — that is where the lifecycle events an
/// operator watches for live (startup, shutdown requested, drain outcomes) — while
/// everything else is floored at `warn` so a dependency that later starts emitting
/// `tracing` events cannot flood the log by default, yet still cannot go silent
/// about a warning or an error. `liminal` is the library crate's lib name (its
/// package is published as `liminal-rs`), which is what `tracing` uses as the
/// event target.
const DEFAULT_FILTER: &str = "warn,liminal_server=info,liminal=info";
/// Installs the process-wide `tracing` subscriber that renders events to stderr.
///
/// Without this the server's 120 `tracing` events — connection failures, drain
/// timeouts, durable-flush failures among them — are dropped by the no-op global
/// dispatcher and the process runs from boot to shutdown printing nothing.
///
/// Output goes to **stderr** (the `fmt` builder's own default is stdout), leaving
/// stdout free for anything the operator pipes.
///
/// `RUST_LOG` is honoured when set; when it is unset — or set to something
/// `EnvFilter` cannot parse — [`DEFAULT_FILTER`] applies instead.
///
/// Installing a global subscriber can only ever succeed once per process, so this
/// uses `try_init` and treats an already-installed dispatcher as success: a
/// consumer that embeds this crate and installs its own subscriber first keeps it,
/// and neither case is worth aborting startup over.