The optional filename must be specified in the call to MLogInit(), normally in the MGUIMain() function. MLogInit() sets also the initial tracing level, the log window geometry and the number of messages to hold in the buffer.
A log message is generated by the program via the call to Mlog(). The first argument specifies the message level, the remaining are a format string and the value list, with printf() syntax. The call to Mlog() will take effect only if the current tracing level is equal to or higher than the value of the first argument. For example, the call:
MLog(3, "this is line: %d", __LINE__);
will generate a log message only if the current tracing level is equal to or higher than 3.
The tracing level can be changed at any time by the program code via a call to the function MLogSetLevel(). The user can also change this level run-time, activating the control dialog with the key sequence <Shift-Ctrl-F2>.
A more sophisticated filtering can be obtained by using the function MMaskedLog(). The message will take effect if the current tracing level is equal to or higher than the level in the call and the current bit-mask has at least one bit in common with the mask specified in the call.