LogMessage

Struct LogMessage 

Source
pub struct LogMessage {
    pub message: String,
    pub file: Option<&'static str>,
    pub line: Option<u32>,
    pub time: SystemTime,
    pub level: LogLevel,
    pub show_time: bool,
}
Expand description

A log message with metadata.

Fields§

§message: String

The message content

§file: Option<&'static str>

File where the log was called

§line: Option<u32>

Line number

§time: SystemTime

Timestamp

§level: LogLevel

Log level

§show_time: bool

Whether to show the timestamp

Implementations§

Source§

impl LogMessage

Source

pub fn new(message: &str) -> Self

Create a new log message.

Source

pub fn location(self, file: &'static str, line: u32) -> Self

Set the file and line.

Source

pub fn level(self, level: LogLevel) -> Self

Set the log level.

Source

pub fn show_time(self, show: bool) -> Self

Set whether to show the timestamp.

Trait Implementations§

Source§

impl Debug for LogMessage

Source§

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

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

impl Renderable for LogMessage

Source§

fn render(&self, _context: &RenderContext) -> Vec<Segment>

Render this object to a sequence of segments. Read more
Source§

fn min_width(&self) -> usize

Get the minimum width required to render this object.
Source§

fn max_width(&self) -> usize

Get the maximum/natural width of this object.

Auto Trait Implementations§

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> Measurable for T
where T: Renderable,

Source§

fn measure(&self, width: usize) -> Measurement

Measure this renderable at the given width.
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.