Struct slog::Logger
[−]
[src]
pub struct Logger { /* fields omitted */ }
Logging handle used to execute logging statements
Logger handles logging context (key-value list) and handles logging statements.
Child loggers are build from existing loggers, and inherit existing key-value pairs from their parents, which can be supplemented with new ones.
Cloning existing loggers and creating new ones is cheap. Loggers can be freely passed around the code.
Methods
impl Logger
[src]
fn root<D: 'static + Drain<Error = Never> + Sized + Send + Sync>(
d: D,
values: Option<Box<SyncMultiSerialize>>
) -> Logger
d: D,
values: Option<Box<SyncMultiSerialize>>
) -> Logger
Build a root Logger
All children and their children and so on form one hierarchy sharing a common drain.
Root logger starts a new hierarchy associated with a given Drain
. Root
logger drain must return no errors. See DrainExt::ignore_err()
and
DrainExt::fuse()
.
Use o!
macro to help build key-value pairs with a nicer syntax.
#[macro_use] extern crate slog; fn main() { let _root = slog::Logger::root( slog::Discard, o!("key1" => "value1", "key2" => "value2"), ); }
fn new(&self, values: Option<Box<SyncMultiSerialize>>) -> Logger
Build a child logger
Child logger inherits all existing key-value pairs from it's parent.
All children, their children and so on, form one hierarchy sharing a common drain.
Use o!
macro to help build key value pairs using nicer syntax.
#[macro_use] extern crate slog; fn main() { let root = slog::Logger::root(slog::Discard, o!("key1" => "value1", "key2" => "value2")); let _log = root.new(o!("key" => "value")); }
fn log(&self, record: &Record)
Log one logging record
Use specific logging functions instead. See log!
macro
documentation.
Trait Implementations
impl Clone for Logger
[src]
fn clone(&self) -> Logger
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more