Struct slog_extlog::stats::StatsLoggerBuilder [−][src]
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::<DefaultStatisticsLogFormatter>::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.
stat_formatter: PhantomData<T>
An object that handles formatting the individual statistic values into a log.
Implementations
impl<T: StatisticsLogFormatter> StatsLoggerBuilder<T>
[src]
pub fn with_stats(self, stats: Vec<StatDefinitions>) -> Self
[src]
Set the list of statistics to track.
pub fn fuse(self, logger: Logger) -> StatisticsLogger<T>
[src]
Construct the StatisticsLogger - this will start the interval logging if requested.
Trait Implementations
impl<T: Debug> Debug for StatsLoggerBuilder<T> where
T: StatisticsLogFormatter,
[src]
T: StatisticsLogFormatter,
impl<T> Default for StatsLoggerBuilder<T> where
T: StatisticsLogFormatter,
[src]
T: StatisticsLogFormatter,
Auto Trait Implementations
impl<T> RefUnwindSafe for StatsLoggerBuilder<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for StatsLoggerBuilder<T>
impl<T> Sync for StatsLoggerBuilder<T>
impl<T> Unpin for StatsLoggerBuilder<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for StatsLoggerBuilder<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SendSyncUnwindSafe for T where
T: Send + Sync + UnwindSafe + ?Sized,
[src]
T: Send + Sync + UnwindSafe + ?Sized,
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.
pub 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>,