Struct yall::Logger

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

The main struct of this crate which implements the Log trait.

Create one using with_level or with_verbosity and then call init or try_init on it.

Implementations§

source§

impl Logger

source

pub fn new() -> Logger

Create a Logger with the default Info level

source

pub fn with_level(level: LevelFilter) -> Logger

Create a Logger with the given level.

source

pub fn with_verbosity(level: u8) -> Logger

Create a Logger with the given “verbosity” number. Useful for translating a number of -v flags in command-line arguments.

0 = Off, 1 = Error, 2 = Warn, 3 = Info, 4 = Debug, 5+ = Trace

source

pub fn verbose(self, change: u8) -> Logger

Increase the verbosity level by the amount given. Takes a u8 as returned by clap::ArgMatches::get_count.

source

pub fn quiet(self, change: u8) -> Logger

Decrease the verbosity level by the amount given. Takes a u8 as returned by clap::ArgMatches::get_count.

source

pub fn color(self, c: ColorMode) -> Logger

Sets the color mode, see ColorMode for details.

source

pub fn full_filename(self, full: bool) -> Logger

By default, yall will shorten the filename displayed in Debug and Trace logs by removing a “src/” prefix and “.rs” suffix, if present. Use this function to disable that and print the full unchanged filename.

source

pub fn try_init(self) -> Result<(), SetLoggerError>

Register this as the global logger with the log crate. May fail if the application has already set a logger.

source

pub fn init(self)

Same as try_init but panic on failure.

Trait Implementations§

source§

impl Debug for Logger

source§

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

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

impl Default for Logger

source§

fn default() -> Self

Create a Logger with the default Info level

source§

impl Log for Logger

source§

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

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

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

Logs the Record. Read more
source§

fn flush(&self)

Flushes any buffered records.

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere 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 Twhere 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.