Add observability using the tracing crate
This commit is contained in:
@@ -1,9 +1,18 @@
|
||||
use contextswitch_api::observability::{get_subscriber, init_subscriber};
|
||||
use contextswitch_api::taskwarrior;
|
||||
use mktemp::Temp;
|
||||
use once_cell::sync::Lazy;
|
||||
use std::fs;
|
||||
use std::net::TcpListener;
|
||||
|
||||
static TRACING: Lazy<()> = Lazy::new(|| {
|
||||
let subscriber = get_subscriber("info".to_string());
|
||||
init_subscriber(subscriber);
|
||||
});
|
||||
|
||||
pub fn spawn_app() -> String {
|
||||
Lazy::force(&TRACING);
|
||||
|
||||
let listener = TcpListener::bind("127.0.0.1:0").expect("Failed to bind random port");
|
||||
let port = listener.local_addr().unwrap().port();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user