pub fn set_default_instrumentation(
default: fn() -> Option<Box<dyn Instrumentation>>,
) -> QueryResult<()>
Expand description
Set a custom constructor for the default Instrumentation
used by new connections
use diesel::connection::{set_default_instrumentation, Instrumentation, InstrumentationEvent};
// a simple logger that prints all events to stdout
fn simple_logger() -> Option<Box<dyn Instrumentation>> {
// we need the explicit argument type there due
// to bugs in rustc
Some(Box::new(|event: InstrumentationEvent<'_>| {
println!("{event:?}")
}))
}
set_default_instrumentation(simple_logger);