[−][src]Struct slog_extlog::stats::StatisticsLogger
A logger with statistics tracking.
This should only be created through the new method.
Implementations
impl<T> StatisticsLogger<T> where
T: StatisticsLogFormatter + Send + Sync + 'static, [src]
T: StatisticsLogFormatter + Send + Sync + 'static,
pub fn new(logger: Logger, cfg: StatsConfig<T>) -> StatisticsLogger<T>[src]
Create a child logger with stats tracking support.
The StatsConfig must contain the definitions necessary to generate metrics from logs.
pub fn with_params<P>(&self, params: OwnedKV<P>) -> Self where
P: SendSyncRefUnwindSafeKV + 'static, [src]
P: SendSyncRefUnwindSafeKV + 'static,
Build a child logger with new parameters.
This is essentially a wrapper around slog::Logger::new().
pub fn update_stats(&self, log: &dyn StatTrigger)[src]
Update the statistics for the current log.
pub fn set_slog_logger(&mut self, logger: Logger)[src]
Modify the logger field without changing the stats tracker
pub fn get_stats(&self) -> Vec<StatSnapshot>[src]
Retrieve the current values of all stats tracked by this logger.
Methods from Deref<Target = Logger>
pub fn new<T>(&self, values: OwnedKV<T>) -> Logger<D> where
D: Clone,
T: SendSyncRefUnwindSafeKV + 'static, [src]
D: Clone,
T: SendSyncRefUnwindSafeKV + 'static,
Build a child logger
Child logger inherits all existing key-value pairs from its parent and supplements them with additional ones.
Use o! macro to build OwnedKV object.
Drain cloning (D : Clone requirement)
All children, their children and so on, form one tree sharing a
common drain. This drain, will be Cloned when this method is called.
That is why Clone must be implemented for D in Logger<D>::new.
For some Drain types Clone is cheap or even free (a no-op). This is
the case for any Logger returned by Logger::root and it's children.
When using Logger::root_typed, it's possible that cloning might be
expensive, or even impossible.
The reason why wrapping in an Arc is not done internally, and exposed
to the user is performance. Calling Drain::log through an Arc is
tiny bit slower than doing it directly.
#[macro_use] extern crate slog; fn main() { let root = slog::Logger::root(slog::Discard, o!("key1" => "value1", "key2" => "value2")); let _log = root.new(o!("key" => "value")); }
pub fn log(&self, record: &Record<'_>)[src]
Log one logging Record
Use specific logging functions instead. See log! macro
documentation.
pub fn list(&self) -> &OwnedKVList[src]
Get list of key-value pairs assigned to this Logger
pub fn to_erased(
&self
) -> Logger<Arc<dyn SendSyncRefUnwindSafeDrain<Err = NeverStruct, Ok = ()> + 'static>> where
D: SendRefUnwindSafeDrain + 'static + Clone, [src]
&self
) -> Logger<Arc<dyn SendSyncRefUnwindSafeDrain<Err = NeverStruct, Ok = ()> + 'static>> where
D: SendRefUnwindSafeDrain + 'static + Clone,
Create a copy with "erased" type
See into_erased
Trait Implementations
impl<T: StatisticsLogFormatter> Clone for StatisticsLogger<T>[src]
fn clone(&self) -> Self[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
impl<T: Debug + StatisticsLogFormatter> Debug for StatisticsLogger<T>[src]
impl<T: StatisticsLogFormatter> Deref for StatisticsLogger<T>[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for StatisticsLogger<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for StatisticsLogger<T> where
T: Send + Sync,
T: Send + Sync,
impl<T> Sync for StatisticsLogger<T> where
T: Send + Sync,
T: Send + Sync,
impl<T> Unpin for StatisticsLogger<T>
impl<T> UnwindSafe for StatisticsLogger<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
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,
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> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut 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>,