Struct spirit_log::Extras
source · pub struct Extras<O, C> { /* private fields */ }
Expand description
Description of extra configuration for logging.
This allows customizing the logging as managed by this crate, mostly by pairing it with command
line options (see Opts
) and adding arbitrary additional loggers.
The default does nothing (eg. no command line options and no extra loggers).
Implementations§
source§impl<O, C> Extras<O, C>
impl<O, C> Extras<O, C>
sourcepub fn with_opts<F: Fn(&O) -> Opts + Send + Sync + 'static>(
extractor: F
) -> Self
pub fn with_opts<F: Fn(&O) -> Opts + Send + Sync + 'static>(
extractor: F
) -> Self
Constructs the Extras
structure with an extractor for options.
The passed closure should take the applications global options structure and return the
Opts
by which the logging from command line can be tweaked.
sourcepub fn extra_loggers<F>(self, extra: F) -> Selfwhere
F: Fn(&O, &C) -> Result<(LevelFilter, Vec<Box<dyn Log>>), Error> + Send + Sync + 'static,
pub fn extra_loggers<F>(self, extra: F) -> Selfwhere
F: Fn(&O, &C) -> Result<(LevelFilter, Vec<Box<dyn Log>>), Error> + Send + Sync + 'static,
Modifies the Extras
to contain another source of additional loggers.
Each such closure is run every time logging is being configured. It can return either bunch of loggers (with the needed log level), or an error. If an error is returned, the loading of new configuration is aborted.