Struct slog_extlog::stats::StatisticsLogger [] [src]

pub struct StatisticsLogger<T: StatisticsLogFormatter> { /* fields omitted */ }

A logger with statistics tracking.

This should only be created through the new method.

Methods

impl<T> StatisticsLogger<T> where
    T: StatisticsLogFormatter + Send + Sync + 'static, 
[src]

[src]

Create a child logger with stats tracking support.

The StatsConfig must contain the definitions necessary to generate metrics from logs.

[src]

Build a child logger with new parameters.

This is essentially a wrapper around slog::Logger::new().

[src]

Update the statistics for the current log.

[src]

Modify the logger field without changing the stats tracker

Important traits for Vec<u8>
[src]

Retrieve the current values of all stats tracked by this logger.

Methods from Deref<Target = Logger>

[src]

Build a child logger

Child logger inherits all existing key-value pairs from its parent and supplements them with additional ones.

Use o! macro to build OwnedKV object.

Drain cloning (D : Clone requirement)

All children, their children and so on, form one tree sharing a common drain. This drain, will be Cloned when this method is called. That is why Clone must be implemented for D in Logger<D>::new.

For some Drain types Clone is cheap or even free (a no-op). This is the case for any Logger returned by Logger::root and it's children.

When using Logger::root_typed, it's possible that cloning might be expensive, or even impossible.

The reason why wrapping in an Arc is not done internally, and exposed to the user is performance. Calling Drain::log through an Arc is tiny bit slower than doing it directly.

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

[src]

Log one logging Record

Use specific logging functions instead. See log! macro documentation.

[src]

Get list of key-value pairs assigned to this Logger

[src]

Create a copy with "erased" type

See into_erased

Trait Implementations

impl<T: Debug + StatisticsLogFormatter> Debug for StatisticsLogger<T>
[src]

[src]

Formats the value using the given formatter. Read more

impl<T: StatisticsLogFormatter> Clone for StatisticsLogger<T>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<T: StatisticsLogFormatter> Deref for StatisticsLogger<T>
[src]

The resulting type after dereferencing.

[src]

Dereferences the value.

Auto Trait Implementations

impl<T> Send for StatisticsLogger<T> where
    T: Send + Sync

impl<T> Sync for StatisticsLogger<T> where
    T: Send + Sync