1 unstable release

0.0.1 Dec 15, 2022

#34 in #output-format

MIT license

74KB
1.5K SLoC

Tracing Formatters

This is a simple formatting module for Tracing that allows for easily setting what type of logging output format should be used.

Formatters

There is currently implemented 2 formaters both with basic functionality, and still a work in progress.

Syslog

To use syslog the following can be done.

use tracing_logger::layer::syslog::Syslog;

let formatting_syslog = LogLayer::new(None, std::io::stdout, Syslog::default());
let subscriber = Registry::default().with(formatting_syslog);
tracing::subscriber::set_global_default(subscriber).expect("Failed to attach log subscriber");

Bunyan

To use Bunyan the following can be done.

use tracing_logger::layer::bunyan::Bunyan;

let formatting_bunyan = LogLayer::new(None, std::io::stdout, Bunyan::default());
let subscriber = Registry::default().with(formatting_bunyan);
tracing::subscriber::set_global_default(subscriber).expect("Failed to attach log subscriber");

Dependencies

~18–32MB
~526K SLoC