[−][src]Function spirit_cfg_helpers::config_logging
pub fn config_logging<E>(level: Level, opts_too: bool) -> impl Extension<E> where
E: Extensible,
E::Opts: Debug,
E::Config: Debug,
An extension to log changes of configuration every time it is reloaded.
This is useful when examining logs, to know with which configuration a problem happened.
Parameters
level
: On which log level the logging should happen.opts_too
: If set totrue
, the log message will contain the command line options as well as the configuration.
Notes
To mask passwords from logs, use the spirit::utils::Hidden
wrapper.
Examples
use log::Level; use spirit::{Empty, Spirit}; use spirit::prelude::*; fn main() { Spirit::<Empty, Empty>::new() .with(spirit_cfg_helpers::config_logging(Level::Info, true)) .run(|_| Ok(())); }