fixed_tag/
fixed_tag.rs

1// To see the logs, run `adb logcat -s tracing-logcat`.
2
3use tracing::{debug, error, info, info_span, trace, warn, Level};
4use tracing_logcat::{LogcatMakeWriter, LogcatTag};
5use tracing_subscriber::fmt::format::Format;
6
7fn main() {
8    let tag = LogcatTag::Fixed(env!("CARGO_PKG_NAME").to_owned());
9    let writer = LogcatMakeWriter::new(tag).expect("Failed to initialize logcat writer");
10
11    tracing_subscriber::fmt()
12        .event_format(Format::default().with_level(false).without_time())
13        .with_writer(writer)
14        .with_ansi(false)
15        .with_max_level(Level::TRACE)
16        .init();
17
18    let _span = info_span!("span", foo = "bar").entered();
19
20    trace!("trace!");
21    debug!("debug!");
22    info!("info!");
23    warn!("warn!");
24    error!("error!");
25}