Struct bp3d_logger::Logger

source ·
pub struct Logger { /* private fields */ }
Expand description

The main Logger type allows to control the entire logger state and submit messages for logging.

Implementations§

source§

impl Logger

source

pub fn enable_stdout(&self, flag: bool)

Enables the stdout/stderr logger.

§Arguments
  • flag: true to enable stdout, false to disable stdout.
source

pub fn raw_log(&self, msg: &LogMsg)

Low-level log function. This injects log messages directly into the logging thread channel.

This function applies basic formatting depending on the backend:

  • For stdout/stderr backend the format is <target> [level] msg.
  • For file backend the format is [level] msg and the message is recorded in the file corresponding to the log target.

WARNING: For optimization reasons, this function does not check and thus does neither honor the enabled flag nor the current log level. For a checked log function, use checked_log.

source

pub fn log(&self, msg: &LogMsg)

Main log function. This injects log messages into the logging thread channel only if this logger is enabled.

This function calls the raw_log function only when this logger is enabled.

source

pub fn filter(&self) -> LevelFilter

Returns the filter level of this logger instance.

source

pub fn set_filter(&self, filter: LevelFilter)

Sets the new level filter for this logger.

§Arguments
source

pub fn is_enabled(&self) -> bool

Returns true if the logger is currently enabled and is capturing log messages.

source

pub fn flush(&self)

Flushes all pending messages.

Trait Implementations§

source§

impl Drop for Logger

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl !Freeze for Logger

§

impl !RefUnwindSafe for Logger

§

impl Send for Logger

§

impl Sync for Logger

§

impl Unpin for Logger

§

impl !UnwindSafe for Logger

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>,

§

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>,

§

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.