[][src]Macro tcprint::tcreport

macro_rules! tcreport {
    (@inner $cps:expr, $dest:expr, $type:expr, $prefix:expr, $($fmt_args:expr),*) => { ... };
    ($cps:expr, info : $($fmt_args:expr),*) => { ... };
    ($cps:expr, warning : $($fmt_args:expr),*) => { ... };
    ($cps:expr, error : $($fmt_args:expr),*) => { ... };
}

Print a colorized log message.

The syntax of this macro is:

This example is not tested
tcreport!(state, level: format, args...);

Where state is an expression evaluating to a ColorPrintState, level is literal text matching one of: info, warning, or error, and format, args... are passed through the standard Rust string formatting mechanism.

Example

let pet_type = "puppy";
tcreport!(state, warning: "could not locate {}", pet_type);

This will emit the text warning: could not locate puppy, where the portion warning: appears in bold yellow by default.

Details

The color palette structure associated with the ColorPrintState must implement the ReportingColors trait. For the BasicColors struct, the info level is associated with (bold) green, warning with bold yellow, and error with bold red.

Messages of the info level are printed to standard output. Messages of warning and error levels are printed to standard error.