log::macros::log![src]
macro_rules! log( ($lvl:expr, $($arg:tt)+) => ({ static LOC: ::log::LogLocation = ::log::LogLocation { line: line!(), file: file!(), module_path: module_path!(), }; let lvl = $lvl; if log_enabled!(lvl) { format_args!(|args| { ::log::log(lvl, &LOC, args) }, $($arg)+) } }) )
The standard logging macro
This macro will generically log over a provided level (of type u32) with a
format!-based argument list. See documentation in std::fmt for details on
how to use the syntax.
Example
#![feature(phase)] #[phase(plugin, link)] extern crate log; fn main() { log!(log::DEBUG, "this is a debug message"); log!(log::WARN, "this is a warning {}", "message"); log!(6, "this is a custom logging level: {level}", level=6u); }#![feature(phase)] #[phase(plugin, link)] extern crate log; log!(log::DEBUG, "this is a debug message"); log!(log::WARN, "this is a warning {}", "message"); log!(6, "this is a custom logging level: {level}", level=6u);