Logger

Struct Logger 

Source
pub struct Logger<Targ, Time>
where Targ: Targets + Send + Sync + 'static, Time: Timing + Send + Sync + 'static,
{ pub targets: Targ, pub start: Time, }
Expand description

Logger

TODO: The fields of this struct are public only because generics on const fns are unstable.

Fields§

§targets: Targ§start: Time

Implementations§

Source§

impl<Targ, Time> Logger<Targ, Time>
where Targ: Targets + Send + Sync + 'static, Time: Timing + Send + Sync + 'static,

Source

pub fn new(targets: Targ, start: Time) -> Self

Creates a new Logger.

TODO: This function should be const but that is unstable with generic parameters, thus the fields of the logger are made public instead.

Source

pub fn start(&self) -> &Time

Returns a reference to the start field.

Source

pub fn start_mut(&mut self) -> &mut Time

Returns a mutable reference to the start field.

This can be used to have a static mut logger and change the start at the beginning of the program.

Source

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

Source

pub fn init_static(&'static self) -> Result<(), SetLoggerError>

Source

pub unsafe fn init_static_racy(&'static self) -> Result<(), SetLoggerError>

Trait Implementations§

Source§

impl<Targ, Time> Log for Logger<Targ, Time>
where Targ: Targets + Send + Sync + 'static, Time: Timing + Send + Sync + 'static,

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. Read more

Auto Trait Implementations§

§

impl<Targ, Time> Freeze for Logger<Targ, Time>
where Targ: Freeze, Time: Freeze,

§

impl<Targ, Time> RefUnwindSafe for Logger<Targ, Time>
where Targ: RefUnwindSafe, Time: RefUnwindSafe,

§

impl<Targ, Time> Send for Logger<Targ, Time>

§

impl<Targ, Time> Sync for Logger<Targ, Time>

§

impl<Targ, Time> Unpin for Logger<Targ, Time>
where Targ: Unpin, Time: Unpin,

§

impl<Targ, Time> UnwindSafe for Logger<Targ, Time>
where Targ: UnwindSafe, Time: UnwindSafe,

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.