[][src]Macro emit::emit

macro_rules! emit {
    (target: $target:expr, $lvl:expr, $s:expr, $($n:ident: $v:expr),*) => { ... };
    ($lvl:expr, $s:expr, $($n:ident: $v:expr),*) => { ... };
}

Emit an event to the ambient pipeline.

Examples

The event below collects a user property and is emitted if the pipeline level includes LogLevel::Info.

This example is not tested
emit!(emit::LogLevel::Info, "Hello, {}!", user: env::var("USERNAME").unwrap());

A target expression may be specified if required. When omitted the target property will carry the current module name.

This example is not tested
emit!(target: "greetings", emit::LogLevel::Info, "Hello, {}!", user: env::var("USERNAME").unwrap());