Enum session_log::Context
source · pub enum Context<'a> {
Log {
time: DateTime<Local>,
level: Level,
file: &'static str,
line: u32,
logger: &'a str,
session: Option<&'a str>,
message: &'a str,
},
SessionStart {
time: DateTime<Local>,
file: &'static str,
line: u32,
logger: &'a str,
session: &'a str,
},
SessionEnd {
time: DateTime<Local>,
elapsed: i64,
file: &'static str,
line: u32,
logger: &'a str,
session: &'a str,
},
}Expand description
Context of each log message.
Variants§
Log
Regular log message. All log made by logger will have this context.
Fields
SessionStart
Start of a session. Occurs when a logger session is constructed.
SessionEnd
End of a session. Occurs when a logger session is destructed.
Implementations§
source§impl Context<'_>
impl Context<'_>
sourcepub fn get_level(&self) -> Option<&Level>
pub fn get_level(&self) -> Option<&Level>
Get the level of the context. Only available for log messages.
sourcepub fn get_logger(&self) -> &str
pub fn get_logger(&self) -> &str
Get the logger entry name of the context.
sourcepub fn get_session(&self) -> Option<&str>
pub fn get_session(&self) -> Option<&str>
Get the session name of the context.
sourcepub fn get_message(&self) -> &str
pub fn get_message(&self) -> &str
Get the message of the context.
sourcepub fn get_time_str(&self) -> String
pub fn get_time_str(&self) -> String
Get the default formatted string of time.
[YYYY]-[MM]-[DD]T[HH]:[mm]:[ss.ssssss]+[ZZ:ZZ]
sourcepub fn get_name(&self) -> String
pub fn get_name(&self) -> String
Get the default formatted string of name.
If session is none, the logger name is returned.
Otherwise, the "{logger}:{session}" is returned.
sourcepub fn get_location_str(&self) -> String
pub fn get_location_str(&self) -> String
Get the default formatted string of location. "{file}:{line}"
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Context<'a>
impl<'a> RefUnwindSafe for Context<'a>
impl<'a> Send for Context<'a>
impl<'a> Sync for Context<'a>
impl<'a> Unpin for Context<'a>
impl<'a> UnwindSafe for Context<'a>
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