log

Function log 

Source
pub fn log(message: &str, t: LogType, p: Option<&str>) -> Result<String, Error>
Expand description

Log a message to stdout and, optionally, a file. This function will format the message with a type-signifier and the timestamp of the moment of logging.

Example:

[WARNING] 2024-02-21 12:05:51 -> This is a logged message!

message -> the message to print. t -> the LogType to use. Defines both the type-signifier in the stdout/file and whether this message should be logged at all, depending on the global LogLevel set.
p -> A custom path for the logger to write this message to. When None the logger will write to the default path set with set_path. A custom path can be specified like so: Some("/the/path/here").