diff --git a/rust/pact_ffi/src/log/inmem_buffer.rs b/rust/pact_ffi/src/log/inmem_buffer.rs index 45f61374..07e12bd6 100644 --- a/rust/pact_ffi/src/log/inmem_buffer.rs +++ b/rust/pact_ffi/src/log/inmem_buffer.rs @@ -7,7 +7,6 @@ use std::sync::Mutex; use bytes::{BufMut, Bytes, BytesMut}; use lazy_static::lazy_static; -use tokio::task_local; use tracing_subscriber::fmt::MakeWriter; /// In-memory buffer for logging output. Sends output to global static `LOG_BUFFER` in the pact_matching @@ -47,11 +46,13 @@ lazy_static! { static ref LOG_BUFFER: Mutex> = Mutex::new(HashMap::new()); } -task_local! { - /// Log ID to accumulate logs against - #[allow(missing_docs)] - pub static LOG_ID: String; -} +// TODO: This needs to be moved from pact_matching, but at the moment the mock server crate +// relies on it +// task_local! { +// /// Log ID to accumulate logs against +// #[allow(missing_docs)] +// pub static LOG_ID: String; +// } /// Fetches the contents from the id scoped in-memory buffer and empties the buffer. pub fn fetch_buffer_contents(id: &str) -> Bytes { @@ -64,7 +65,9 @@ pub fn fetch_buffer_contents(id: &str) -> Bytes { /// Writes the provided bytes to the task local ID scoped in-memory buffer. If there is no /// task local ID set, will write to the "global" buffer. pub fn write_to_log_buffer(buf: &[u8]) { - let id = LOG_ID.try_with(|id| id.clone()).unwrap_or_else(|_| "global".into()); + let id = pact_matching::logging::LOG_ID + .try_with(|id| id.clone()) + .unwrap_or_else(|_| "global".into()); let mut inner = LOG_BUFFER.lock().unwrap(); let buffer = inner.entry(id) .or_insert_with(|| BytesMut::with_capacity(256));