1use tracing::{debug, error, info, instrument, trace, warn};
9use tracing_subscriber::prelude::*;
10use tracing_systemd::SystemdLayer;
11
12fn main() {
13 tracing_subscriber::registry()
14 .with(
15 SystemdLayer::stdout()
16 .with_target(true)
17 .with_thread_ids(true)
18 .with_level_prefix(false),
19 )
20 .init();
21
22 root_log_fn(true);
23}
24
25#[instrument(fields(outside_instrument_field = true))]
26fn root_log_fn(_param: bool) {
27 info!("Root log");
28 inner_log_1(true);
29}
30
31#[instrument(fields(inside_instrument_field = true))]
32fn inner_log_1(_inside_parameter_field: bool) {
33 trace!("this is a trace");
34 debug!(field_in_function = "also works");
35 info!("this is an info log");
36 warn!("Inner log 1");
37 error!("this is an error");
38}