[][src]Macro service_logging::log

macro_rules! log {
    ( $qu:expr,  $sev:expr,  $( $k:tt $_t:tt  $v:expr ),* ) => { ... };
}

The log! macro can be used to create structured log entries for later use by logger.send

use service_logging::{prelude::*, log, LogQueue, Severity};
let mut lq = LogQueue::default();
let url = "https://example.com";

log!(lq, Severity::Info,
    method: "GET",
    url: url,
    status: 200
);

Parameters are of the form: (queue, severity, key:value, key:value, ...). queue is any object that implements fn add(&mut self, e: LogEntry) (such as LogQueue or [wasm_service::Context])

Values can be anything that implements ToString Key names must use the same syntax as a rust identifier, e.g., no spaces, punctuation, etc.

The following keys are "special" (known to Coralogix and used for categorization in the coralogix dashboard): text, category, class_name, method_name, thread_id If text is not defined, all non-coralogix keys are converted into a json string and passed as the value of 'text'. (If text is also defined, any non-coralogix keys will be silently dropped).