Trait quil::Target [] [src]

pub trait Target {
    fn log(&mut self, level: Level, message: &str, context: &Context);
}

Structs that implement Target can be used with Logger.

Examples

An example of a basic target that prints to the console:

struct Print;

impl Target for Print {
  fn log(&mut self, level: Level, message: &str, context: &Context) {
    println!("LEVEL: {}, MSG: {}, CTX: {}", level, message, context);
  }
}

Required Methods

You shouldn't need to call log directly. log is called by logger internally.

Log a message to each target contained within the TargetSet.

Arguments

  • level - The log level the message is associated with.
  • message - The message to log.
  • context - The context containing meta data associated with the message.

Implementors