Crate slog [] [src]

Slog - Structured, extensible, composable logging for Rust

Features

Advantages over log crate

Notable details

slog by default removes at compile time trace and debug level statements in release builds, and trace level records in debug builds. This makes trace and debug level logging records practically free, which should encourage using them freely. If you want to enable trace/debug messages or raise the compile time logging level limit, use the following in your Cargo.toml:

slog = { version = "1.2", features = ["max_level_trace", "release_max_level_warn"] }

Due to the macro_rules limitation log macros syntax comes in several versions. See log! macro, and pay attention to ; and , details.

Root drain (passed to Logger::root) must be one that does not ever return errors, which forces user to pick error handing strategy. You can use .fuse() or .ignore_err() methods from DrainExt to do it conveniently.

Examples & help

Look at slog-rs examples in slog-misc repository

Read slog-rs wiki pages

Check sources of other software using slog-rs

Visit slog-rs gitter channel for immediate help.

Reexports

pub use ser::PushLazy;
pub use ser::ValueSerializer;
pub use ser::Serializer;
pub use ser::Serialize;

Modules

ser

Serialization

Macros

crit

Log critical level record

debug

Log debug level record

error

Log error level record

info

Log info level record

log

Log message of a given level

o

Convenience macro for building SyncMultiSerialize trait object

slog_crit

Log critical level record (alias)

slog_debug

Log debug level record (alias)

slog_error

Log error level record

slog_info

Log info level record (alias)

slog_log

Log message of a given level (alias)

slog_o

An alternative, longer-name version of o macro

slog_trace

Log trace level record (alias)

slog_warn

Log warning level record (alias)

trace

Log trace level record

warn

Log warning level record

Structs

Discard

Drain discarding everything

Duplicate

Drain duplicating records into two other Drains

Filter

Drain filtering records

Fuse

Drain panicking on error

IgnoreErr

Drain ignoring errors

LevelFilter

Drain filtering records by Record logging level

Logger

Logging handle used to execute logging statements

MapError

Drain mapping error returned by another Drain

OwnedKeyValueList

Chain of SyncMultiSerialize-s of a Logger and its ancestors

OwnedKeyValueListIterator

Iterator over OwnedKeyValue-s

Record

One logging record

Enums

DuplicateError

Logging error returned by Duplicate drain

FilterLevel

Logging filtering level

Level

Logging level associated with a logging Record

Statics

LOG_LEVEL_NAMES

Official capitalized logging (and logging filtering) level names

LOG_LEVEL_SHORT_NAMES

Official capitalized logging (and logging filtering) short level names

Traits

Drain

Logging drain

DrainExt

Convenience methods for building drains

Functions

duplicate

Duplicate records to two drains

filter

Filter by cond closure

level_filter

Filter by log level

Type Definitions

BorrowedKeyValue

Key value pair that can be part of a logging record

OwnedKeyValue

Key value pair that can be owned by Logger