#logger

sloggers

This library provides frequently used slog loggers and convenient functions

23 releases

✓ Uses Rust 2018 edition

0.3.5 Dec 11, 2019
0.3.4 Sep 8, 2019
0.3.3 Aug 18, 2019
0.3.2 Feb 6, 2019
0.2.0 Jun 15, 2017

#8 in #logger

Download history 1714/week @ 2019-10-07 788/week @ 2019-10-14 1571/week @ 2019-10-21 1168/week @ 2019-10-28 1108/week @ 2019-11-04 782/week @ 2019-11-11 1004/week @ 2019-11-18 972/week @ 2019-11-25 1545/week @ 2019-12-02 1722/week @ 2019-12-09 1486/week @ 2019-12-16 890/week @ 2019-12-23 1922/week @ 2019-12-30 2954/week @ 2020-01-06 2260/week @ 2020-01-13

5,628 downloads per month
Used in 24 crates (21 directly)

MIT license

52KB
1K SLoC

sloggers - convenience library for slog

Crates.io: sloggers Documentation Build Status Code Coverage License: MIT Gitter: slog

sloggers provides frequently used slog loggers and convenient functions.

Documentation

Join gitter for help


lib.rs:

This crate provides frequently used slog loggers and convenient functions.

Examples

Creates a logger via TerminalLoggerBuilder:

use slog::info;
use sloggers::Build;
use sloggers::terminal::{TerminalLoggerBuilder, Destination};
use sloggers::types::Severity;

let mut builder = TerminalLoggerBuilder::new();
builder.level(Severity::Debug);
builder.destination(Destination::Stderr);

let logger = builder.build().unwrap();
info!(logger, "Hello World!");

Creates a logger from configuration text (TOML):

use slog::info;
use sloggers::{Config, LoggerConfig};

let config: LoggerConfig = serdeconv::from_toml_str(r#"
type = "terminal"
level = "debug"
destination = "stderr"
"#).unwrap();

let logger = config.build_logger().unwrap();
info!(logger, "Hello World!");

Dependencies

~5MB
~107K SLoC