Struct Logger

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

A logger within the Artifact logging library. This struct is somewhat similar to an address. The struct itself only stores the name of the logger. However, the initialization functions tell the backend what kind of logger it is, what level it logs at, and other interesting information.

Implementations§

Source§

impl Logger

Source

pub fn set_default_formatter(fmtr: Box<dyn MessageFormatter>)

Sets the default formatter. This formatter will be used by any logger which does not have a formatter set for it.

Source

pub fn access(name: &str) -> Logger

Creates a Logger instance, but does not tell the backend to initialize the logger.

Source

pub fn access_internal_logger() -> Logger

Accesses the Artifact library’s internal logger. This can be redirected or reformatted to cause the internal logger to log however you need. By default, the internal logger logs to stdout.

Source

pub fn new(name: &str, ty: LoggerOutput) -> Logger

Creates a logger which will log to the given output. This tells the backend logger task to initialize the logger.

Source

pub fn new_with_level(name: &str, ty: LoggerOutput, level: LogLevel) -> Logger

Creates a logger for the given output which logs messages at or above the given level. This also initializes the logger by telling the backend task.

Source

pub fn redirect(&self, ty: LoggerOutput)

Redirects a logger to a new output location. Returns the logger as well

Source

pub fn redirect_set_level(&self, ty: LoggerOutput, level: LogLevel)

Redirects a logger and changes its level Returns the logger

Source

pub fn disable(self)

Prevents use of a logger name, and kills off any existing logger instances with that name

Source

pub fn disable_without_logs(self)

Prevents use of a logger name, kills off any existing loggers with that name, and disables logging info about that logger entirely.

Source

pub fn set_as_default(&self)

Sets the default logger to be this logger.

Source

pub fn set_as_silent_default(&self)

Sets the default logger to be this logger, silently. This means that all logs to an unknown logger will be directed to this logger. However, no addition to the message will be made by this logger.

Source

pub fn set_format(&self, formatter: Box<dyn MessageFormatter>)

Sets the logger’s format

Source

pub fn log(&self, level: LogLevel, message: &str)

Creates a new log message. This just sends a message across the backend channel to the actual logger task.

Source

pub fn wtf(&self, message: &str)

Source

pub fn critical(&self, message: &str)

Source

pub fn severe(&self, message: &str)

Source

pub fn warning(&self, message: &str)

Source

pub fn debug(&self, message: &str)

Source

pub fn info(&self, message: &str)

Source

pub fn trace(&self, message: &str)

Source

pub fn verbose(&self, message: &str)

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 Debug for Logger

Source§

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

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

impl PartialEq for Logger

Source§

fn eq(&self, other: &Logger) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Logger

Source§

impl StructuralPartialEq for Logger

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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

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.