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]

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"),
    );
}

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"));
}

Log one logging record

Use specific logging functions instead.

Trait Implementations

impl Clone for Logger
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more