Struct slog::Logger
[−]
[src]
pub struct Logger { // some fields omitted }
Logger
Loggers are thread-safe and reference counted, so can be freely passed around the code.
Each logger is built with a set of key-values.
Child loggers are build from existing loggers, and copy all the key-values from their parents
Loggers form hierarchies sharing a drain. Setting a drain on any logger will change it on all loggers in given hierarchy.
Methods
impl Logger
[src]
fn root<D: 'static + Drain + Sized>(d: D, values: Vec<OwnedKeyValue>) -> Logger
Build a root logger
All children and their children and so on form one hierarchy sharing a common drain.
Use o!
macro to help build values
#[macro_use] extern crate slog; fn main() { let root = slog::Logger::root( slog::discard(), o!("key1" => "value1", "key2" => "value2"), ); }
fn new(&self, values: Vec<OwnedKeyValue>) -> Logger
Build a child logger
Child logger copies all existing values from the parent.
All children, their children and so on, form one hierarchy sharing a common drain.
Use o!
macro to help build values
#[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.
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