Struct slog::logger::Logger
[−]
[src]
pub struct Logger { // some fields omitted }
Logger
Methods
impl Logger
[src]
fn new_root(values: &[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::new_root(o!("key1" => "value1", "key2" => "value2")); }
fn new(&self, values: &[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::new_root(o!("key1" => "value1", "key2" => "value2")); let log = root.new(o!("key" => "value")); }
fn set_drain<D: Drain>(&self, drain: D)
Set the drain for logger and it's hierarchy
fn swap_drain(&self, drain: Arc<Box<Drain>>) -> Arc<Box<Drain>>
Swap the existing drain with a new one
As the drains are shared between threads, and might still be
referenced Arc
s are being used to reference-count them.
fn log<'a>(&'a self, lvl: Level, msg: &'a str, values: &'a [BorrowedKeyValue<'a>])
Log one logging record
Use specific logging functions instead.
fn critical<'a>(&'a self, msg: &'a str, values: &'a [BorrowedKeyValue<'a>])
Log critical level record
Use b!
macro to help build values
fn error<'a>(&'a self, msg: &'a str, values: &'a [BorrowedKeyValue<'a>])
Log error level record
Use b!
macro to help build values
fn warn<'a>(&'a self, msg: &'a str, values: &'a [BorrowedKeyValue<'a>])
Log warning level record
Use b!
macro to help build values
fn info<'a>(&'a self, msg: &'a str, values: &'a [BorrowedKeyValue<'a>])
Log info level record
Use b!
macro to help build values
fn debug<'a>(&'a self, msg: &'a str, values: &'a [BorrowedKeyValue<'a>])
Log debug level record
Use b!
macro to help build values
fn trace<'a>(&'a self, msg: &'a str, values: &'a [BorrowedKeyValue<'a>])
Log trace level record
Use b!
macro to help build values
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