Function log_message

Source
pub fn log_message(level: &str, now: &str, message: &str)
Expand description

§log_message

The log_message function takes three arguments: level, now, and message.

  • The level argument is a string representing the log level (e.g. “ERROR”, “WARN”, “INFO”, “DEBUG”).
  • The now argument is a string representing the current time and the message argument is the message to be logged.
  • The function matches the log level with a color code and formats the message with the color code and log level. It then checks the current log level and logs the message to either the console, a file, or both depending on the current log level.