Skip to main content

LogLevelController

Trait LogLevelController 

Source
pub trait LogLevelController: Send + Sync {
    // Required methods
    fn set_log_level(&self, filter_str: &str) -> Result<(), String>;
    fn current_filter(&self) -> Option<String>;
}
Expand description

A type-erased interface for changing the tracing log filter at runtime.

This is stored in JanusState so the API module can expose a POST /api/log-level endpoint without depending on tracing_subscriber internals. The concrete implementation lives in crate::logging and is wired up in main() after init_logging() returns.

§Thread Safety

Implementations must be Send + Sync because JanusState is shared across Tokio tasks.

Required Methods§

Source

fn set_log_level(&self, filter_str: &str) -> Result<(), String>

Change the operational (stdout) log filter at runtime.

filter_str uses the same syntax as RUST_LOG, e.g.:

  • "debug"
  • "info,janus=trace"
  • "warn,janus::supervisor=debug,hyper=info"

Returns Ok(()) on success or a human-readable error message.

Source

fn current_filter(&self) -> Option<String>

Returns the current filter string, if available.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§