Trait LoggingInterceptor
pub trait LoggingInterceptor:
Debug
+ Clone
+ Send
+ Sync
+ Unpin
+ 'static {
// Required method
fn log(
&self,
info: &ServiceInfo,
operation: Operation,
context: &[(&str, &str)],
message: &str,
err: Option<&Error>,
);
}Available on crate feature
layers-logging only.Expand description
LoggingInterceptor customizes log emission.
Required Methods§
fn log(
&self,
info: &ServiceInfo,
operation: Operation,
context: &[(&str, &str)],
message: &str,
err: Option<&Error>,
)
fn log( &self, info: &ServiceInfo, operation: Operation, context: &[(&str, &str)], message: &str, err: Option<&Error>, )
Called for every log event.
§Inputs
info: The service information used for this operation.operation: The operation being logged.context: Additional key-value context such as path, range, or counters.message: The event message, such asstarted,finished, orfailed.err: The error associated with this event, if any.
§Performance
This method runs inline with the operation path. Avoid expensive I/O, network calls, or long-running work here.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.