trace2e_core/lib.rs
1//! A distributed traceability middleware.
2//!
3//! This software provides a mediation layer that provides provenance recording
4//! and compliance enforcement on I/O objects such as files or streams. The use
5//! of a custom I/O library is required to wrap standard I/O library methods to
6//! make input/output conditional on middleware authorization.
7//!
8//! A unique instance of this software should run on each node where
9//! traceability is enforced.
10//!
11//! Process/middleware and middleware/middleware communication relies on [`tonic`],
12//! a Rust implementation of gRPC, a high performance, open source RPC framework.
13//!
14//! [`tonic`]: https://docs.rs/tonic
15
16#[cfg(test)]
17pub mod tests;
18
19pub mod traceability;
20pub mod transport;
21
22pub mod trace2e_tracing {
23 use std::sync::Once;
24
25 use tracing_subscriber::{EnvFilter, fmt};
26
27 static INIT: Once = Once::new();
28
29 /// Initialize tracing for tests
30 /// This sets up a tracing subscriber that will display logs during test execution.
31 /// Call this at the beginning of tests that need to see tracing output.
32 pub fn init() {
33 INIT.call_once(|| {
34 let filter =
35 EnvFilter::try_from_default_env().or_else(|_| EnvFilter::try_new("off")).unwrap();
36
37 fmt().with_target(false).with_test_writer().with_env_filter(filter).init();
38 });
39 }
40}