Crates.io | tracing-formatters |
lib.rs | tracing-formatters |
version | 0.0.1 |
source | src |
created_at | 2022-12-15 20:15:01.512166 |
updated_at | 2022-12-15 20:15:01.512166 |
description | Tracing output formatters |
homepage | |
repository | https://github.com/nebula-technologies/tracing-formatters |
max_upload_size | |
id | 738295 |
size | 73,893 |
This is a simple formatting module for Tracing that allows for easily setting what type of logging output format should be used.
There is currently implemented 2 formaters both with basic functionality, and still a work in progress.
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");
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");