pub struct LogStruct {
pub message: String,
pub log_type: LogType,
pub datetime: DateTime<Local>,
}Expand description
Represents a single log entry.
Used internally by LogFormatter, Logger and various log streams.
§Examples
Print a formatted log message:
// Get a formatted log message from a `LogStruct` instance
let log = logger.formatter.lock().unwrap()
.format_log(&LogStruct::error("Much bad!"));
print!("{}", &log);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.
§Examples
Creating a debug log:
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.
§Examples
Creating an informative log:
let info_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.
§Examples
Creating a warning log:
let warning_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.
§Examples
Creating an error log:
let error_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.
§Examples
Creating a fatal error log:
let fatal_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