[−][src]Struct slog_extlog::stats::StatsConfigBuilder
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.
define_stats! { MY_STATS = { SomeStat(Counter, "A test counter", []), SomeOtherStat(Counter, "Another test counter", []) } } fn main() { let full_stats = vec![MY_STATS]; let cfg = StatsConfigBuilder::<DefaultStatisticsLogFormatter>::new() .with_stats(full_stats) .with_log_interval(30) .fuse(); }
Methods
impl<T: StatisticsLogFormatter> StatsConfigBuilder<T>[src]
pub fn new() -> Self[src]
Create a new config builder, using the given formatter.
The formatter must be provided here as it is intrinsic to the builder.
pub fn with_stats(self, defns: Vec<StatDefinitions>) -> Self[src]
Set the list of statistics to track.
pub fn with_log_interval(self, interval: u64) -> Self[src]
Set the logging interval.
pub fn with_core(self, handle: Handle) -> Self[src]
Set the Tokio reactor core to use for the logging of the statistics.
pub fn fuse(self) -> StatsConfig<T>[src]
Return the built configuration.
Trait Implementations
impl<T> Default for StatsConfigBuilder<T> where
T: StatisticsLogFormatter, [src]
T: StatisticsLogFormatter,
Auto Trait Implementations
impl<T> !Send for StatsConfigBuilder<T>
impl<T> !Sync for StatsConfigBuilder<T>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> From<T> for T[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,