test_log_stdout/
test_log_stdout.rs1use tracing::error;
2
3use tracing::{debug, info, instrument, trace, warn};
4use tracing_subscriber::prelude::*;
5use tracing_systemd::SystemdLayer;
6fn main() {
7 tracing_subscriber::registry()
8 .with(
9 SystemdLayer::new()
10 .with_target(true)
11 .use_level_prefix(false)
12 .use_color(true)
13 .with_thread_ids(true),
14 )
15 .init();
16
17 root_log_fn(true);
18}
19
20#[instrument(fields(outside_instrument_field = true))]
21fn root_log_fn(outside_instrument_field: bool) {
22 info!("Root log");
23 inner_log_1(true);
24}
25
26#[instrument(fields(inside_instrument_field = true))]
27fn inner_log_1(inside_parameter_field: bool) {
28 trace!("this is a trace");
29 debug!(field_in_function = "also works");
30 info!("this is an info log");
31 warn!("Inner log 1");
32 error!("this is an error");
33}