pub trait ILogger {
// Required method
fn write_line(&mut self, loglevel: &str, message: &str);
// Provided methods
fn log_trace(&mut self, message: &str) { ... }
fn log_info(&mut self, message: &str) { ... }
fn log_error(&mut self, message: &str) { ... }
}
Expand description
Represents the ability to send logging messages to some kind of output, which is dictated by the required implementation of ILogger::write_line().
Required Methods§
sourcefn write_line(&mut self, loglevel: &str, message: &str)
fn write_line(&mut self, loglevel: &str, message: &str)
Send a formatted line to the logger. Must be implemented by any struct implementing the ILogger trait.
Parameters
-
loglevel
Level of logging (“TRACE”, “INFO”, “ERROR”)
-
message
Message to log
Provided Methods§
sourcefn log_trace(&mut self, message: &str)
fn log_trace(&mut self, message: &str)
Log trace messages to the configured output. A newline will always be added to the message when writing to the log. Default behavior is to send the message to ILogger::write_line().
Parameters
-
message
The message to write to the log.
sourcefn log_info(&mut self, message: &str)
fn log_info(&mut self, message: &str)
Log information messages to the configured output. A newline will always be added to the message when writing to the log. Default behavior is to send the message to ILogger::write_line().
Parameters
-
message
The message to write to the log.
sourcefn log_error(&mut self, message: &str)
fn log_error(&mut self, message: &str)
Log error messages to the configured output. A newline will always be added to the message when writing to the log. Default behavior is to send the message to ILogger::write_line().
Parameters
-
message
The message to write to the log.