Crates.io | tracing-print |
lib.rs | tracing-print |
version | 0.0.3 |
source | src |
created_at | 2024-10-31 00:02:14.480937 |
updated_at | 2024-10-31 05:36:08.249318 |
description | Simple println format for tracing-subscriber |
homepage | https://github.com/pbar1/tracing-print |
repository | https://github.com/pbar1/tracing-print |
max_upload_size | |
id | 1429367 |
size | 26,345 |
A simple println
-like format for tracing-subscriber
.
Prints the message field of an event and no others. Formats the message according to log level:
ERROR
: redWARN
: yellowINFO
: no formattingDEBUG
: blueTRACE
: dimlet layer = tracing_subscriber::fmt::layer()
.event_format(tracing_print::Print::default());
Run this example: cargo run --example simple
tracing::error!("error");
tracing::warn!("warn");
tracing::info!("info");
tracing::debug!("debug");
tracing::trace!("trace");
// Functions as a newline
tracing::info!("");
// Other keys than message won't be displayed
tracing::info!(key = "unseen", "only message will be seen");
// Format macros work like normal
tracing::info!(
"newlines and formatting work\nsee? display={}, debug={:#?}",
1337,
Dummy::default()
);
// Extra ANSI colors can also be applied
tracing::info!(
"{} {} {}",
"extra".bold(),
"ansi".underline(),
"formatting".italic()
);
tracing::error!("{}", "applies before level".underline())
Looks like this:
error warn info debug trace only message will be seen newlines and formatting work see? display=1337, debug=Dummy { _field: (), } extra ansi formattingapplies before level