pub mod bundle;
pub mod error;
pub mod logging;
pub mod network_trace;
pub mod profiler;
pub mod sanitizer;
#[allow(unused_imports)]
pub use bundle::{BundleScope, DiagnosticBundle, SystemInfo as BundleSystemInfo};
#[allow(unused_imports)]
pub use error::ObservabilityError;
#[allow(unused_imports)]
pub use logging::{LogConfig, LogFormat, LogLevel, init_debug_logging};
#[allow(unused_imports)]
pub use network_trace::{DomainStats, NetworkSummary, NetworkTiming, NetworkTracer};
#[allow(unused_imports)]
pub use profiler::{PhaseTiming, ProfileReport, Profiler};
pub use sanitizer::Sanitizer;
#[derive(Debug, Clone, Default)]
#[allow(dead_code)] pub struct ObservabilityConfig {
pub log: LogConfig,
pub profile: bool,
pub profile_output: Option<String>,
pub trace_network: bool,
pub network_log: Option<String>,
}
#[allow(dead_code)] impl ObservabilityConfig {
#[allow(clippy::too_many_arguments)]
pub fn from_flags(
quiet: bool,
verbose: u8,
log_format: Option<&str>,
debug_filter: Option<&str>,
log_file: Option<&str>,
profile: bool,
profile_output: Option<&str>,
trace_network: bool,
network_log: Option<&str>,
) -> Self {
let level = if quiet {
LogLevel::Quiet
} else {
match verbose {
0 => LogLevel::Normal,
1 => LogLevel::Verbose,
2 => LogLevel::Debug,
_ => LogLevel::Trace,
}
};
let format = match log_format {
Some("json") => LogFormat::Json,
_ => LogFormat::Text,
};
Self {
log: LogConfig {
level,
format,
filter: debug_filter.map(|s| s.to_string()),
file: log_file.map(|s| s.to_string()),
disable_file_logging: false,
},
profile,
profile_output: profile_output.map(|s| s.to_string()),
trace_network,
network_log: network_log.map(|s| s.to_string()),
}
}
}