pub fn json_thread() -> DefaultGuardExpand description
Turn on json defaults for the local thread returning a guard, when the guard is dropped the layers will be unsubscribed.
ยงExamples
Example of using two subscribers on the same thread, second event loses field from first span
use traceon::{info, info_span};
let _guard = traceon::on_thread();
let _span = info_span!("span_with_field", field = "temp", "cool").entered();
info!("first subscriber");
let _guard = traceon::json_thread();
let _span = info_span!("span_with_no_field").entered();
info!("second subscriber")output:
11:58:50 INFO first subscriber
field: temp
span: span_with_field
{
"time": "2023-01-02T04:59:00.841691+00:00",
"level": "INFO",
"message": "second subscriber",
"span": "span_with_no_field"
}