Struct Log

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

See module docs.

Implementations§

Source§

impl Log

Source

pub fn set_file_name<P: AsRef<Path>>(path: P)

Creates a new log file at the specified path.

Source

pub fn set_file(file: Option<File>)

Sets new file to write the log to.

Source

pub fn write<S>(kind: MessageKind, msg: S)
where S: AsRef<str>,

Writes a string to the console and optionally into the file (if set).

Source

pub fn write_once<S>(id: usize, kind: MessageKind, msg: S) -> bool
where S: AsRef<str>,

Writes a string to the console and optionally into the file (if set). Unlike Self::write this method writes the message only once per given id if the message remains the same. If the message changes, then the new version will be printed to the log. This method is useful if you need to print error messages, but prevent them from flooding the log.

Source

pub fn writeln<S>(kind: MessageKind, msg: S)
where S: AsRef<str>,

Writes a string to the console and optionally into the file (if set), adds a new line to the end of the message.

Source

pub fn writeln_once<S>(id: usize, kind: MessageKind, msg: S) -> bool
where S: AsRef<str>,

Writes a string to the console and optionally into the file (if set), adds a new line to the end of the message. Prints the message only once. See Self::write_once for more info.

Source

pub fn info<S>(msg: S)
where S: AsRef<str>,

Writes an information message.

Source

pub fn warn<S>(msg: S)
where S: AsRef<str>,

Writes a warning message.

Source

pub fn err<S>(msg: S)
where S: AsRef<str>,

Writes error message.

Source

pub fn info_once<S>(id: usize, msg: S) -> bool
where S: AsRef<str>,

Writes an information message once. See Self::write_once for more info.

Source

pub fn warn_once<S>(id: usize, msg: S) -> bool
where S: AsRef<str>,

Writes a warning message. See Self::write_once for more info.

Source

pub fn err_once<S>(id: usize, msg: S) -> bool
where S: AsRef<str>,

Writes an error message once. See Self::write_once for more info.

Source

pub fn set_verbosity(kind: MessageKind)

Sets verbosity level.

Source

pub fn add_listener(listener: Sender<LogMessage>)

Adds a listener that will receive a copy of every message passed into the log.

Source

pub fn verify<T, E>(result: Result<T, E>)
where E: Debug,

Allows you to verify that the result of the operation is Ok, or print the error in the log.

§Use cases

Typical use case for this method is that when you can ignore errors, but want them to be in the log.

Source

pub fn verify_message<S, T, E>(result: Result<T, E>, msg: S)
where E: Debug, S: Display,

Allows you to verify that the result of the operation is Ok, or print the error in the log.

§Use cases

Typical use case for this method is that when you can ignore errors, but want them to be in the log.

Auto Trait Implementations§

§

impl Freeze for Log

§

impl RefUnwindSafe for Log

§

impl Send for Log

§

impl Sync for Log

§

impl Unpin for Log

§

impl UnwindSafe for Log

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> AsyncTaskResult for T
where T: Any + Send + 'static,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

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> Downcast for T
where T: Any,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts self reference as a reference to Any. Could be used to downcast a trait object to a particular type.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts self reference as a reference to Any. Could be used to downcast a trait object to a particular type.
Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Source§

impl<T> FieldValue for T
where T: 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Casts self to a &dyn Any
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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V