pub struct LogStruct {
pub message: String,
pub log_type: LogType,
pub datetime: DateTime<Local>,
}Expand description
Represents a single log entry.
Can be used to create custom log messages or storing logs in memory for later use.
§Example:
// Get a formatted log message from a `LogStruct` instance:
let log_string = logger.format_log(&LogStruct::error("Much bad!"));Fields§
§message: StringThe log message
log_type: LogTypeThe type of the log (e.g., Debug, Info, Warning, etc.)
datetime: DateTime<Local>The date and time at which the log struct was instantiated
Implementations§
Source§impl LogStruct
impl LogStruct
Sourcepub fn debug(message: &str) -> LogStruct
pub fn debug(message: &str) -> LogStruct
Returns a LogStruct with debug preset applied.
§Example
let debug_log = LogStruct::debug("This is a debug log!");Sourcepub fn info(message: &str) -> LogStruct
pub fn info(message: &str) -> LogStruct
Returns a LogStruct with info preset applied.
§Example
let debug_log = LogStruct::info("This is an info log!");Sourcepub fn warning(message: &str) -> LogStruct
pub fn warning(message: &str) -> LogStruct
Returns a LogStruct with warning preset applied.
§Example
let debug_log = LogStruct::warning("This is a warning!");Sourcepub fn error(message: &str) -> LogStruct
pub fn error(message: &str) -> LogStruct
Returns a LogStruct with error preset applied.
§Example
let debug_log = LogStruct::error("This is an error!");Sourcepub fn fatal_error(message: &str) -> LogStruct
pub fn fatal_error(message: &str) -> LogStruct
Returns a LogStruct with fatal error preset applied.
§Example
let debug_log = LogStruct::fatal_error("This is a fatal error!");Trait Implementations§
Source§impl Ord for LogStruct
impl Ord for LogStruct
Source§impl PartialOrd for LogStruct
impl PartialOrd for LogStruct
impl Eq for LogStruct
impl StructuralPartialEq for LogStruct
Auto Trait Implementations§
impl Freeze for LogStruct
impl RefUnwindSafe for LogStruct
impl Send for LogStruct
impl Sync for LogStruct
impl Unpin for LogStruct
impl UnwindSafe for LogStruct
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