2 unstable releases
0.1.0 | Mar 13, 2020 |
---|---|
0.0.1 | Mar 12, 2020 |
#886 in Debugging
13KB
265 lines
logfmt formatter for slog
This is a pretty straightforward logfmt
formatter with a customizable prefix. The formatter exposed by the
crate is not Send
or Sync
, so you'll have to wrap it in
slog-async
or similar.
lib.rs
:
slog_logfmt
- a logfmt
formatter for slog.
This crate exposes a slog
drain that formats messages as logfmt.
Example
use slog_logfmt::Logfmt;
use slog::{debug, o, Drain, Logger};
use std::io::stdout;
let drain = Logfmt::new(stdout()).build().fuse();
let drain = slog_async::Async::new(drain).build().fuse();
let logger = Logger::root(drain, o!("logger" => "tests"));
debug!(logger, #"tag", "hi there"; "foo" => "bar'baz\"");
Writes:
DEBG | #tag hi there logger="tests" foo="bar\'baz\""
Dependencies
~160KB