Skip to main content

Logger

Struct Logger 

Source
pub struct Logger { /* private fields */ }
Expand description

A named logger with a runtime severity threshold.

Threshold defaults to Severity::Info. Use register_logger to publish a 'static Logger so multiple call sites with the same name share the same threshold.

Implementations§

Source§

impl Logger

Source

pub const fn new(name: &'static str) -> Self

const-construct with the default threshold (Severity::Info).

Source

pub const fn with_level(name: &'static str, level: Severity) -> Self

const-construct with an explicit threshold.

Source

pub const fn name(&self) -> &'static str

Logger name (used as Record::logger_name).

Source

pub fn level(&self) -> Severity

Current runtime threshold.

Source

pub fn set_level(&self, level: Severity)

Update the runtime threshold.

Source

pub fn is_enabled(&self, severity: Severity) -> bool

Whether a record at severity would be emitted by this logger AT RUNTIME.

Source

pub fn dispatch(&self, record: &Record<'_>)

Hand record to every registered sink, after the runtime threshold check.

Macros call this; user code should not.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.