Trait omake::Logger

source ·
pub trait Logger: Clone + Debug {
    // Required method
    fn write(&self, msg: String);

    // Provided methods
    fn info(&self, msg: impl AsRef<str>, context: Option<&Context>) { ... }
    fn warn(&self, msg: impl AsRef<str>, context: Option<&Context>) { ... }
    fn error(&self, msg: impl AsRef<str>, context: Option<&Context>) { ... }
    fn format_log(
        &self,
        msg: impl AsRef<str>,
        level: &str,
        context: Option<&Context>
    ) -> String { ... }
}

Required Methods§

source

fn write(&self, msg: String)

Write the message somewhere.

Provided Methods§

source

fn info(&self, msg: impl AsRef<str>, context: Option<&Context>)

Log an INFO message.

source

fn warn(&self, msg: impl AsRef<str>, context: Option<&Context>)

Log a WARN message.

source

fn error(&self, msg: impl AsRef<str>, context: Option<&Context>)

Log an ERROR message.

source

fn format_log( &self, msg: impl AsRef<str>, level: &str, context: Option<&Context> ) -> String

Formatter for all log messages.

Implementors§

source§

impl Logger for DefaultLogger

By default, print to stderr.