#[cfg(feature = "performance-optimized")]
pub mod performance;
#[cfg(feature = "correlation-enhanced")]
pub mod correlation;
#[cfg(feature = "convenience")]
pub mod convenience;
#[cfg(feature = "convenience")]
pub mod context_adapter;
pub mod panic_handler;
pub mod extension;
mod error;
pub use observability_core::{
BatchingConfig,
BatchingManager,
CompactJsonFormatter,
ContextPort,
FormatterPort,
JsonFormatter,
LogEntry,
ObservabilityConfig,
ObservabilityError,
ObservabilityManager,
ObservabilityResult,
ProcessorChain,
StandardLogAdapter,
StandardLoggingPort,
TransportPort,
W3CTraceContext,
WasmStdoutAdapter,
traits::LogLevel,
};
pub use observability_core::domain::TraceContext;
pub use error::{Result, StructuredLoggingError};
pub use extension::{
EnhancedObservabilityConfig, PerformanceExtension, create_performance_extension,
create_performance_extension_from_config,
};
pub use panic_handler::{
PanicHandlerConfig, PanicPattern, PanicSeverity, PanicStats, StructuredPanicInfo, ThreadInfo,
get_panic_stats, install_panic_handler, install_panic_handler_with_config, reset_panic_stats,
};
#[cfg(feature = "performance-optimized")]
pub use performance::{
BufferPool, FastPathLogger, OptimizedWasmStdoutAdapter, PerformanceStats,
StringInterningProcessor,
};
#[cfg(feature = "correlation-enhanced")]
pub use correlation::{
BaggageManager, CorrelationProcessor, EnhancedTraceContext, ScopedContextManager,
W3CBaggageSupport,
};
#[cfg(feature = "convenience")]
pub use convenience::{
A2AContext,
ConvenienceManager,
DomainContextProcessor,
LLMContext,
TemplateContext,
clear_a2a_context,
clear_all_contexts,
clear_llm_context,
clear_request_context,
clear_template_context,
emit_a2a_message_latency,
emit_counter,
emit_histogram,
emit_llm_request_duration,
emit_llm_tokens_used,
emit_request_duration,
emit_template_render_duration,
log_a2a_message,
log_llm_request,
log_template_render,
set_a2a_context,
set_llm_context,
set_request_context,
set_template_context,
};
#[cfg(feature = "convenience")]
pub use context_adapter::{
A2aContextGuard,
A2aContextManager,
AllContextsGuard,
ContextManagerRegistry,
LlmContextGuard,
LlmContextManager,
RequestContextGuard,
RequestContextManager,
ScopedContextBuilder,
StructuredA2aContextManager,
StructuredContextRegistry,
StructuredLlmContextManager,
StructuredRequestContextManager,
init_context_integration,
set_a2a_context_scoped,
set_all_contexts_scoped,
set_llm_context_scoped,
set_request_context_scoped,
with_a2a_context,
with_all_contexts,
with_llm_context,
with_request_context,
};
#[cfg(feature = "convenience")]
pub use extension::ConvenienceConfig;
#[cfg(feature = "correlation-enhanced")]
pub use extension::CorrelationConfig;
#[cfg(feature = "performance-optimized")]
pub use extension::PerformanceConfig;
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
pub fn create_logger() -> ObservabilityResult<ObservabilityManager> {
ObservabilityManager::new(ObservabilityConfig::default())
}
#[cfg(feature = "performance-optimized")]
pub fn create_performance_logger() -> Result<PerformanceExtension> {
PerformanceExtension::new(EnhancedObservabilityConfig::default())
}
pub fn create_logger_from_config(
config: ObservabilityConfig,
) -> ObservabilityResult<ObservabilityManager> {
ObservabilityManager::new(config)
}
pub fn create_enhanced_logger_from_config(
config: EnhancedObservabilityConfig,
) -> Result<PerformanceExtension> {
PerformanceExtension::new(config)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_basic_logger_creation() {
let logger = create_logger();
assert!(logger.is_ok());
}
#[cfg(feature = "performance-optimized")]
#[test]
fn test_performance_logger_creation() {
let logger = create_performance_logger();
assert!(logger.is_ok());
}
#[test]
fn test_version_constant() {
assert!(!VERSION.is_empty());
}
}