Previous - Up - Next

5.4   Logging

Logging support is built into the language. Log groups are defined with the global declaration loggroup. For example:

loggroup config;
loggroup request;
loggroup response;

Log outputs are made with the log statement as follows:

log type, level, groups, string, [value]

where the parameters mean:

One of the strings:
An integer from 1 through 4, determining the verbosity level at which the message will be logged.
One or several log groups, as defined by the loggroup statement, combined with the bitwise or operator "|". If no log groups are defined, the integer 1 makes sense to use.
string, values
A formatting string, as for the C function printf(), optionally followed by a comma separated list of values to be printed.

A small example:

loggroup example;

method m(uint32 val) {
        log "info", 4, example : "val=%u", val;

Previous - Up - Next