Expand description
Record prometheus metrics for messages logged.
Use the MonitoringDrainBuilder to configure a drain, putting it in an appropriate spot in the slog drain stack.
use slog::{info, Drain};
let decorator = slog_term::TermDecorator::new().build();
let drain = slog_term::FullFormat::new(decorator).build().fuse();
let drain = slog_async::Async::new(drain).build();
let drain = slog_prometheus::MonitoringDrainBuilder::new(drain)
.build()
.expect("Failed configuring setting up prometheus")
.fuse();
let drain = slog::LevelFilter::new(drain, slog::Level::Info).fuse();
let logger = slog::Logger::root(drain, slog::o!());
info!(logger, "Finished setting up!");
Structs§
- Monitoring
Drain - The main monitoring struct, implementing slog::Drain
- Monitoring
Drain Builder - Helper struct to build the MonitoringDrain conveniently
Enums§
- Monitoring
Drain Error - During build, prometheus might return an error, which requires this crate to return an error.