Skip to main content

init_logging

Function init_logging 

Source
pub fn init_logging(verbose: bool) -> Result<()>
Expand description

Initializes logging infrastructure.

Sets up tracing with appropriate log levels based on verbosity flag. Writes log messages to stderr, with any embedded URL’s credentials/query string redacted (via a wrapping Write adapter around the fmt layer’s writer) — this covers rmcp and any other dependency’s log lines, not just this project’s own, since a dependency’s tracing output cannot go through this crate’s Debug/escape_error_text redaction paths.

§Arguments

  • verbose - If true, sets log level to DEBUG; otherwise uses INFO or environment variable override via RUST_LOG

§Errors

This function cannot fail—it always returns Ok(()). Multiple calls in the same process will panic rather than returning an error, but this is not a recoverable condition and indicates a programming error.

§Examples

use mcp_execution_cli::runner;

// `no_run`: this installs a process-global tracing subscriber, which
// panics if called more than once in the same process.
runner::init_logging(false)?;