mod event;
#[expect(
dead_code,
reason = "consumed by the pipeline (`Telemetry`, `Exporter`), not in place yet"
)]
mod store;
#[expect(
dead_code,
reason = "consumed by the pipeline (`Telemetry`, `Exporter`), not in place yet"
)]
mod stats;
#[expect(
dead_code,
reason = "consumed by the pipeline (`Telemetry`, `Exporter`), not in place yet"
)]
mod scope;
#[expect(
dead_code,
reason = "consumed by the pipeline (`Telemetry`, `Exporter`), not in place yet"
)]
mod span;
#[expect(
dead_code,
reason = "consumed by the pipeline (`Telemetry`, `Exporter`), not in place yet"
)]
mod otlp;
mod proto;
pub use event::*;
pub use span::SpanOutcome;
pub use stats::{TelemetryStats, TelemetryStatus};
#[cfg(feature = "uniffi")]
uniffi::setup_scaffolding!();
#[cfg(test)]
pub(crate) mod test_log {
use std::sync::{Mutex, Once};
use std::thread::{self, ThreadId};
static LINES: Mutex<Vec<(ThreadId, String)>> = Mutex::new(Vec::new());
struct Capture;
impl log::Log for Capture {
fn enabled(&self, metadata: &log::Metadata) -> bool {
metadata.level() <= log::Level::Warn
}
fn log(&self, record: &log::Record) {
if self.enabled(record.metadata()) {
let line = (thread::current().id(), record.args().to_string());
LINES.lock().unwrap_or_else(|e| e.into_inner()).push(line);
}
}
fn flush(&self) {}
}
pub fn capture() {
static INSTALL: Once = Once::new();
INSTALL.call_once(|| {
log::set_logger(&Capture).expect("the only logger in tests");
log::set_max_level(log::LevelFilter::Warn);
});
}
pub fn take() -> Vec<String> {
let me = thread::current().id();
let mut lines = LINES.lock().unwrap_or_else(|e| e.into_inner());
let (mine, others): (Vec<_>, Vec<_>) =
std::mem::take(&mut *lines).into_iter().partition(|(id, _)| *id == me);
*lines = others;
mine.into_iter().map(|(_, line)| line).collect()
}
}