Module prelude

Source
Expand description

A set of common imports needed by most programs that use slog.

It is intended to be used like follows:

use slog::prelude::*;
fn my_func(logger: &Logger, x: i32) {
    info!(logger, "slog rules!"; "x" => x);
    if x < 0 {
        warn!(logger, "negative numbers are scary"; "x" => x);
    }
}

This includes the logging macros (log!, trace!, …) and slog::Logger. It also includes slog::Serde and slog::FnValue, as those are frequently useful as well.

Adding new items here is a breaking change, because it can cause conflicts with other bulk-imported modules.

Re-exports§

pub use crate::Serde;
pub use crate::FnValue;
pub use crate::Logger;

Macros§

crit
Log critical level record
debug
Log debug level record
error
Log error level record
info
Log info level record
log
Log message a logging record
trace
Log trace level record
warn
Log warning level record