Enum session_log::Context
source · pub enum Context {
Header {
time: Time,
source: Source,
location: Location,
},
Footer {
time: Time,
source: Source,
location: Location,
elapsed: Duration,
},
Message {
time: Time,
source: Source,
location: Location,
level: Level,
message: String,
},
}Expand description
Context type is presenting one line of logging with their corresponding information. It has three variants: Header, Footer, and Message. Header and Footer are used to represent the start and end of the logging session, while Message is used to represent the actual logging message. This type cannot be created outside of the library.
Variants§
Implementations§
source§impl Context
impl Context
sourcepub fn level(&self) -> Option<Level>
pub fn level(&self) -> Option<Level>
Get the level of the context. (Only available for Message variant)
sourcepub fn message(&self) -> Option<&str>
pub fn message(&self) -> Option<&str>
Get the message of the context. (Only available for Message variant)
sourcepub fn start(&self) -> Option<&Time>
pub fn start(&self) -> Option<&Time>
Get the start time of the context. (Only available for Header variant)
sourcepub fn elapsed(&self) -> Option<Duration>
pub fn elapsed(&self) -> Option<Duration>
Get the elapsed time of the context. (Only available for Footer variant)
Check if the context is a footer.
sourcepub fn is_message(&self) -> bool
pub fn is_message(&self) -> bool
Check if the context is a message.
Auto Trait Implementations§
impl Freeze for Context
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more