Struct carboncopy::Logger[][src]

pub struct Logger { /* fields omitted */ }

Takes entries and filter/submit them to the provided backend implementation.

Implementations

impl Logger[src]

pub fn new(max_level: Level, sink: Arc<dyn Sink + Send + Sync>) -> Self[src]

Creates a new Logger connected to backend implementation sink. This Logger will ignore and discard entries at severity levels lower than max_level.

pub fn log<T: Clone + Serialize>(
    &self,
    mode: SinkMode,
    level: Level,
    entry: Entry<T>
) -> SinkAcknowledgment<'_>
[src]

Logs entry at the specified severity level. This Logger will ignore and discard entries at severity levels lower than self.max_level().

pub fn log_expensive<F, T: Clone + Serialize>(
    &self,
    mode: SinkMode,
    level: Level,
    func: F
) -> SinkAcknowledgment<'_> where
    F: FnOnce() -> Entry<T>, 
[src]

Logs an Entry obtained through an expensive computation in function func. If level is lower than self.max_level(), logging won’t be performed so there is no need to execute func.

pub fn log_blocking<T: Clone + Serialize>(
    &self,
    level: Level,
    entry: Entry<T>
) -> Option<Result<()>>
[src]

Shortcut for self.log(SinkMode::Blocking, level, entry). If level is ignored, None is returned.

pub fn log_async<T: Clone + Serialize>(
    &self,
    level: Level,
    entry: Entry<T>
) -> Option<BoxFuture<'_, Result<()>>>
[src]

Shortcut for self.log(SinkMode::Awaitable, level, entry). If level is ignored, None is returned.

pub fn log_expensive_blocking<F, T: Clone + Serialize>(
    &self,
    level: Level,
    func: F
) -> Option<Result<()>> where
    F: FnOnce() -> Entry<T>, 
[src]

Shortcut for self.log_expensive(SinkMode::Blocking, level, func). If level is ignored, None is returned.

pub fn log_expensive_async<F, T: Clone + Serialize>(
    &self,
    level: Level,
    func: F
) -> Option<BoxFuture<'_, Result<()>>> where
    F: FnOnce() -> Entry<T>, 
[src]

Shortcut for self.log_expensive(SinkMode::Awaitable, level, func). If level is ignored, None is returned.

pub fn max_level(&self) -> Level[src]

Returns the lowest level entry which this Logger will sink into the backend.

pub fn set_max_level(&mut self, level: Level)[src]

Sets the lowest level entry which this Logger will sink into the backend.

Auto Trait Implementations

impl !RefUnwindSafe for Logger

impl Send for Logger

impl Sync for Logger

impl Unpin for Logger

impl !UnwindSafe for Logger

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.