Struct mod_logger::Logger

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

The Logger struct holds a singleton containing all relevant information.

struct Logger has a private constructor. It is used via its static interface which will instantiate a Logger or use an existing one.

Implementations§

source§

impl Logger

source

pub fn flush()

Flush the contents of log buffers

source

pub fn create()

create a default logger

source

pub fn set_default_level(log_level: Level)

Initialise a Logger with the given default log_level or modify the default log level of the existing logger

source

pub fn get_default_level(&self) -> Level

Retrieve the default level of the logger

source

pub fn set_mod_level(module: &str, log_level: Level)

Modify the log level for a module

source

pub fn get_buffer() -> Option<Vec<u8>>

Retrieve the current log buffer, if available

source

pub fn set_log_dest<S: 'static + Write + Send>( dest: &LogDestination, stream: Option<S> ) -> Result<(), Error>

Set the log destination

source

pub fn set_log_file( log_dest: &LogDestination, log_file: &Path, buffered: bool ) -> Result<(), Error>

Set log destination and log file.

source

pub fn get_log_dest() -> LogDestination

Retrieve the current log destination

source

pub fn set_color(color: bool)

Enable / disable colored output

source

pub fn set_timestamp(val: bool)

Enable / disable timestamp in messages

source

pub fn set_millis(val: bool)

Enable / disable timestamp in messages

source

pub fn set_brief_info(val: bool)

Enable / disable brief info messages

Trait Implementations§

source§

impl Clone for Logger

source§

fn clone(&self) -> Logger

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Log for Logger

source§

fn enabled(&self, _metadata: &Metadata<'_>) -> bool

Determines if a log message with the specified metadata would be logged. Read more
source§

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

Logs the Record. Read more
source§

fn flush(&self)

Flushes any buffered records.

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§

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.