1pub mod aggregation;
28pub mod alerting;
29pub mod correlation;
30pub mod dashboard;
31pub mod metrics;
32pub mod persistence;
33pub mod profiling;
34pub mod sanitization;
35pub mod structured;
36pub mod telemetry;
37
38pub use aggregation::{
40 AggregationConfig, AggregationError, LogAggregator, LogDestination, LogEntry, RetryConfig,
41 SyslogProtocol,
42};
43pub use alerting::{
44 Alert, AlertConfig, AlertError, AlertManager, AlertRule, AlertSeverity, AlertState,
45 ComparisonOperator, MetricType, NotificationChannel,
46};
47pub use correlation::{
48 CorrelationConfig, CorrelationContext, CorrelationError, CorrelationHeaders,
49 CorrelationManager, CorrelationStats, RequestTraceEntry,
50};
51pub use dashboard::{
52 AggregationType, ChartConfig, ChartData, ChartOptions, ChartSeries, ChartStyling, ChartType,
53 DashboardConfig, DashboardLayout, DashboardManager, DashboardSection, DashboardTheme,
54 DataPoint, DataSource, GridPosition, LineStyle, Threshold,
55};
56pub use metrics::{
57 BusinessMetrics, ErrorMetrics, ErrorRecord, HealthMetrics, MetricsCollector, MetricsSnapshot,
58 RequestMetrics, get_metrics,
59};
60pub use persistence::{MetricsPersistence, PersistedMetrics, PersistenceConfig, RotationInterval};
61pub use profiling::{
62 AsyncTaskProfile, AsyncTaskState, CpuProfilingConfig, FlameGraphConfig, FlameGraphData,
63 FlameGraphNode, FunctionCall, FunctionCallProfile, MemoryProfilingConfig, MemorySnapshot,
64 PerformanceHotspot, PerformanceProfiler, PerformanceThresholds, ProfilingConfig,
65 ProfilingError, ProfilingSession, ProfilingSessionType, ProfilingStats, StackFrame,
66};
67pub use sanitization::{LogSanitizer, SanitizationConfig};
68pub use structured::{ErrorClass, StructuredContext, StructuredLogger};
69pub use telemetry::{
70 BatchProcessingConfig, JaegerConfig, OtlpConfig, SamplingConfig, SamplingStrategy,
71 TelemetryConfig, TelemetryError, TelemetryManager, ZipkinConfig, propagation, spans,
72};
73
74pub type Result<T> = std::result::Result<T, LoggingError>;
78
79pub type LoggingResult<T> = std::result::Result<T, LoggingError>;
81
82#[derive(Debug, thiserror::Error)]
84pub enum LoggingError {
85 #[error("Configuration error: {0}")]
86 Config(String),
87
88 #[error("I/O error: {0}")]
89 Io(#[from] std::io::Error),
90
91 #[error("Serialization error: {0}")]
92 Serialization(#[from] serde_json::Error),
93
94 #[error("Tracing error: {0}")]
95 Tracing(String),
96}
97
98pub trait ErrorClassification: std::fmt::Display + std::error::Error {
102 fn error_type(&self) -> &str;
103 fn is_retryable(&self) -> bool;
104 fn is_timeout(&self) -> bool;
105 fn is_auth_error(&self) -> bool;
106 fn is_connection_error(&self) -> bool;
107}
108
109#[cfg(test)]
110mod lib_tests;