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
//! Shared helpers reused by multiple `mcp` leaves.
//!
//! Currently hosts [`parse_log_level`], which both `mcp start` and
//! `mcp stream` need with byte-identical semantics — including the
//! `tracing::warn!` on unrecognized values that is a deliberate
//! divergence from ophis (which silently maps unknown levels to `Info`).
use ArgMatches;
use Level;
/// Parse the `--log-level` flag into a [`Level`] when present.
///
/// Invalid values return `None` (i.e., fall through to `Config::log_level`
/// or `RUST_LOG`); a `tracing::warn!` records the offending value so users
/// notice the typo at startup rather than wondering why their level had
/// no effect. This is a deliberate divergence from ophis's silent
/// fallback to `Info`.
///
/// Shared between `mcp start` (stdio transport) and `mcp stream`
/// (streamable-HTTP transport) so the two surfaces cannot drift in their
/// `--log-level` parsing semantics. Each surface's `parse_log_level`
/// wrapper exists to keep the call sites in their own module but
/// delegates here without modification.