Skip to content

Commit 52ec779

Browse files
mivertowskiclaude
andcommitted
Add structured logging with trace correlation (Phase 2.2)
- Create logging.rs module with comprehensive structured logging infrastructure - Add LogLevel enum with 6 levels (Trace through Fatal) - Implement LogOutput format options (Text, Json, Compact, Pretty) - Add TraceContext for automatic trace_id/span_id injection - Create LogConfig with builder pattern and presets (development, production) - Implement per-module log level filtering - Add LogEntry with JSON and text formatters - Create StructuredLogger with multi-sink support - Implement LogSink trait with ConsoleSink, MemoryLogSink, FileLogSink - Add global logger functions (init, logger, info, error, etc.) - Include LoggerStats for monitoring log activity - Export types in prelude with renamed aliases to avoid conflicts - Add 14 comprehensive tests Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 99e206f commit 52ec779

2 files changed

Lines changed: 1305 additions & 0 deletions

File tree

crates/ringkernel-core/src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ pub mod tenancy;
7272
pub mod alerting;
7373
pub mod timeout;
7474
pub mod rate_limiting;
75+
pub mod logging;
7576

7677
/// TLS support (requires `tls` feature).
7778
#[cfg(feature = "tls")]
@@ -218,6 +219,15 @@ pub mod prelude {
218219
CertificateInfo, CertificateStore, ClientAuth, SniResolver, TlsAcceptor, TlsConfig,
219220
TlsConfigBuilder, TlsConnector, TlsError, TlsResult, TlsSessionInfo, TlsVersion,
220221
};
222+
pub use crate::logging::{
223+
ConsoleSink, FileLogSink, LogEntry, LogOutput, LogValue, LoggerStats, MemoryLogSink,
224+
StructuredLogger, TraceContext,
225+
LogConfig as StructuredLogConfig,
226+
LogConfigBuilder as StructuredLogConfigBuilder,
227+
LogLevel as StructuredLogLevel,
228+
LogSink as StructuredLogSink,
229+
LogSinkError as StructuredLogSinkError,
230+
};
221231
}
222232

223233
// Re-exports for convenience

0 commit comments

Comments
 (0)