pub struct StatsLoggerBuilder {
pub stats: Vec<StatDefinitions>,
}Expand description
A builder to allow customization of stats config. This gives flexibility when the other methods are insufficient.
Create the builder using new() and chain other methods as required, ending with fuse() to
return the StatsConfig.
§Example
Creating a config with a custom stats interval and the default formatter.
slog_extlog::define_stats! {
MY_STATS = {
SomeStat(Counter, "A test counter", []),
SomeOtherStat(Counter, "Another test counter", [])
}
}
let full_stats = vec![MY_STATS];
let logger = slog::Logger::root(slog::Discard, slog::o!());
let stats = StatsLoggerBuilder::default()
.with_stats(full_stats)
.fuse(logger);
Fields§
§stats: Vec<StatDefinitions>The list of statistics to track. This MUST be created using the
define_stats macro.
Implementations§
Source§impl StatsLoggerBuilder
impl StatsLoggerBuilder
Sourcepub fn with_stats(self, stats: Vec<StatDefinitions>) -> Self
pub fn with_stats(self, stats: Vec<StatDefinitions>) -> Self
Set the list of statistics to track.
Sourcepub fn fuse(self, logger: Logger) -> StatisticsLogger
pub fn fuse(self, logger: Logger) -> StatisticsLogger
Construct the StatisticsLogger
Trait Implementations§
Source§impl Debug for StatsLoggerBuilder
impl Debug for StatsLoggerBuilder
Source§impl Default for StatsLoggerBuilder
impl Default for StatsLoggerBuilder
Source§fn default() -> StatsLoggerBuilder
fn default() -> StatsLoggerBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for StatsLoggerBuilder
impl RefUnwindSafe for StatsLoggerBuilder
impl Send for StatsLoggerBuilder
impl Sync for StatsLoggerBuilder
impl Unpin for StatsLoggerBuilder
impl UnwindSafe for StatsLoggerBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more