pub fn init()
Expand description
Initializes a global subscriber with a ForestLayer
using the default configuration.
This function is intended for quick initialization and processes log trees “inline”,
meaning it doesn’t take advantage of a worker task for formatting and writing.
To use a worker task, consider using the worker_task
function. Alternatively,
configure a Subscriber
manually using a ForestLayer
.
§Examples
use tracing::{info, info_span};
tracing_forest::init();
info!("Hello, world!");
info_span!("my_span").in_scope(|| {
info!("Relevant information");
});
Produces the the output:
INFO i [info]: Hello, world!
INFO my_span [ 26.0µs | 100.000% ]
INFO ┕━ i [info]: Relevant information