.
//
//!
//! # Log Entry
//!
use ::{,};
use ::{, ::};
use super::Level;
///
/// Used to provide relevant information about each log entry.
///
#[derive()]
pub struct LogEntry {
pubtimestamp: <>
pubmod_path:
///
/// This is the name of the function/method inside which this
/// log entry was generated.
///
pubfn_name:
publevel:
pubmessage:
}
impl ::for LogEntry {
fn fmt(&selff: &mut ::<_>) -> :: {
write!(
"{} : {}->{} ({}) {}",
self, self, self, self, self
)
}
}
#[allow()]
impl LogEntry {
pub(crate) fn create(level:fn_name:message:) -> {
{
: ::(),
: String::(),
,
,
,
}
}
pub(crate) fn fn_name(&self) -> {
selfclone()
}
pub(crate) fn level(&self) -> {
self
}
pub(crate) fn message(&self) -> {
selfclone()
}
pub(crate) fn mod_path(&self) -> {
selfclone()
}
pub(crate) fn set_fn_name(&mut selffn_name:) {
self=clone();
}
pub(crate) fn set_mod_path(&mut selfmod_path:) {
self=clone();
}
pub(crate) fn timestamp(&self) -> <> {
self
}
}
#[cfg()]
mod tests {
use super::*;
#[test]
fn to_string() {
let mut=
::(::INFO, "to_string"to_string(), "message"to_string());
set_mod_path(module_path!()to_owned());
println!("\nlog_entry: {log_entry}\n");
assert_eq!(level(), ::INFO);
assert_eq!(message(), "message"to_string());
assert_eq!(fn_name(), "to_string"to_string());
assert_eq!(mod_path(), module_path!());
assert!(timestamp()timestamp() > 0);
set_fn_name("fn_name"to_owned());
assert_eq!(fn_name(), "fn_name"to_string());
}
}