pub struct InterestCacheConfig { /* private fields */ }
Available on crate features interest-cache and log-tracer and std only.
Expand description

The interest cache configuration.

Implementations§

source§

impl InterestCacheConfig

source

pub fn with_min_verbosity(self, level: Level) -> Self

Sets the minimum logging verbosity for which the cache will apply.

The interest for logs with a lower verbosity than specified here will not be cached.

It should be set to the lowest verbosity level for which the majority of the logs in your application are usually disabled.

In normal circumstances with typical logger usage patterns you shouldn’t ever have to change this.

By default this is set to Debug.

source

pub fn with_lru_cache_size(self, size: usize) -> Self

Sets the number of entries in the LRU cache used to cache interests for log records.

The bigger the cache, the more unlikely it will be for the interest in a given callsite to be recalculated, at the expense of extra memory usage per every thread which tries to log events.

Every unique level + target pair consumes a single slot in the cache. Entries will be added to the cache until its size reaches the value configured here, and from then on it will evict the least recently seen level + target pair when adding a new entry.

The ideal value to set here widely depends on how much exactly you’re logging, and how diverse the targets are to which you are logging.

If your application spends a significant amount of time filtering logs which are not getting printed out then increasing this value will most likely help.

Setting this to zero will disable the cache.

By default this is set to 1024.

Trait Implementations§

source§

impl Debug for InterestCacheConfig

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for InterestCacheConfig

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.