pub trait StructuredLogger: Send + Sync {
// Required methods
fn log_with_trace(
&self,
level: LogLevel,
message: &str,
fields: &JsonValue,
trace_id: Option<&str>,
span_id: Option<&str>,
);
fn log_performance(
&self,
operation: &str,
duration: Duration,
success: bool,
additional_fields: &JsonValue,
);
fn log_error(&self, error: &dyn Error, context: &JsonValue);
fn set_level(&mut self, level: LogLevel);
fn is_level_enabled(&self, level: LogLevel) -> bool;
}Expand description
Trait for structured logging
Required Methods§
Sourcefn log_with_trace(
&self,
level: LogLevel,
message: &str,
fields: &JsonValue,
trace_id: Option<&str>,
span_id: Option<&str>,
)
fn log_with_trace( &self, level: LogLevel, message: &str, fields: &JsonValue, trace_id: Option<&str>, span_id: Option<&str>, )
Log with trace context correlation
Sourcefn log_performance(
&self,
operation: &str,
duration: Duration,
success: bool,
additional_fields: &JsonValue,
)
fn log_performance( &self, operation: &str, duration: Duration, success: bool, additional_fields: &JsonValue, )
Log performance metrics
Sourcefn is_level_enabled(&self, level: LogLevel) -> bool
fn is_level_enabled(&self, level: LogLevel) -> bool
Check if a level is enabled
Implementors§
impl StructuredLogger for NoOpStructuredLogger
Available on crate feature
structured-logging only.