Expand description
Shared logging library with structured logging, context propagation, redaction, and HTTP middleware.
§Features
- Structured logger wrapper with consistent field names
- Context propagation: trace_id, span_id, request_id, user_id, tenant_id
- Redaction helpers for PII, secrets, and tokens
- Standard event schema with consistent field names and error formatting
- HTTP middleware for request ID injection and request lifecycle logging
- Optional OpenTelemetry log correlation
§Example
use shared_logging::{init_logger, Logger};
// Initialize the logger
init_logger("my-service", "info").unwrap();
// Create a logger instance
let logger = Logger::new("my-module");
// Log with context
logger.info("User logged in", |e| {
e.field("user_id", "user123");
});Re-exports§
pub use context::Context;pub use context::ContextBuilder;pub use logger::init_logger;pub use logger::Logger;pub use redaction::Redaction;pub use redaction::Redactor;pub use schema::Event;pub use schema::Level;pub use schema::StandardFields;