Crates.io | tracing-foramtters |
lib.rs | tracing-foramtters |
version | 0.1.0 |
source | src |
created_at | 2022-12-15 19:42:59.097425 |
updated_at | 2022-12-15 19:42:59.097425 |
description | Tracing output formatters |
homepage | |
repository | https://github.com/nebula-technologies/tracing-formatters |
max_upload_size | |
id | 738279 |
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");