Main Page   Modules   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

Log Tracing

This group includes functions for printing log messages to file and to a window. More...

Functions

void MLogInit (int level, int nr, int nvr, int nc, int nvc, const char *fname)
 Sets the log level, log window geometry and log filename.

void MLog (int level, const char *fmt,...)
 Prints a formatted log string in the log window (and the log file if enabled).

void MMaskedLog (int level, CARD32 mask, const char *fmt,...)
 Prints a formatted log string in the log window using the context mask.

void MLogSetLevel (int level)
 Sets the current log-level.

void MLogSetMask (CARD32 mask)
 Sets the current log mask.

CARD32 MLogGetMask (void)
 Retrieves the current log mask containing enabled log contexts.

void MLogSetMaskBits (CARD32 mask)
 Adds bits to the current log mask enabling more log contexts.

void MLogResetMaskBits (CARD32 mask)
 Clears bits in the current log mask disabling some log contexts.

void Trace (const char *fmt,...)
 Prints a low level tracing message to the trace file.

void MSetTraceFileName (const char *fname)
void MLogSetTimeFormat (const char *strftime_format)
 Enables/disables automatic timestamps in log outputs.

void MTraceSetTimeFormat (const char *strftime_format)
 Enables/disables automatic timestamps in trace outputs.


Detailed Description

This group includes functions for printing log messages to file and to a window.

MGUI provides a run time log printing both to a window and optionally to a file. Logging is filtered using a threshold level and an optional context mask. By default the context mask is disabled.

A lower level tracing to file is also supported for debugging.


Function Documentation

void MLog int    level,
const char *    fmt,
...   
 

Prints a formatted log string in the log window (and the log file if enabled).

You can call this function anywhere in your MGUI program, provided your calling method belongs to a class that inherits from CmMGUI.

Parameters:
level Log level associated with the call. The log string is actually printed only if this value is higher than or equal to the current log-level.
fmt A format string with sprintf syntax.
See also:
MLogInit, MLogSetLevel, MMaskedLog, MLogSetMask

CARD32 MLogGetMask void   
 

Retrieves the current log mask containing enabled log contexts.

See also:
MLogInit, MLogSetMask, MLogSetMaskBits, MLogResetMaskBits

void MLogInit int    level,
int    nr,
int    nvr,
int    nc,
int    nvc,
const char *    fname
 

Sets the log level, log window geometry and log filename.

All log requests, made later by the program and having a level lower than the one provided as the first parameter, are ignored.

Parameters:
level Starting log level.
nr Desired number of rows you want to be saved in the log window.
nvr Desired number of visible rows (this value should be lower or equal to nr).
nc Desired number of columns you want to use in the log window.
nvc Desired number of visible columns (this value should be lower than or equal to nc).
fname Specifies the name of the file which you want to write log messages to. If you don't want to log to file, simply pass a NULL pointer.
See also:
MLog, MLogSetLevel, MLogSetMask

void MLogResetMaskBits CARD32    mask
 

Clears bits in the current log mask disabling some log contexts.

The current log mask is obtained by 'and-ing' the old mask with the negated new one specified as argument.

Parameters:
mask Mask containing the contexts to be disabled. You can specify up to 32 different contexts for log masking.
See also:
MLogInit, MLogSetMask, MLogGetMask, MLogSetMaskBits

void MLogSetLevel int    level
 

Sets the current log-level.

Parameters:
level New log level.
See also:
MLogInit, MLog

void MLogSetMask CARD32    mask
 

Sets the current log mask.

The old mask is replaced by the new one specified as argument.

Parameters:
mask New log mask. You can specify up to 32 different contexts for log masking.
See also:
MLogGetMask, MLogInit, MLogSetMaskBits, MLogResetMaskBits

void MLogSetMaskBits CARD32    mask
 

Adds bits to the current log mask enabling more log contexts.

The old mask is or-ed with the new one specified as argument.

Parameters:
mask Mask containing the contexts to be enabled. You can specify up to 32 different contexts for log masking.
See also:
MLogInit, MLogSetMask, MLogGetMask, MLogResetMaskBits

void MLogSetTimeFormat const char *    strftime_format
 

Enables/disables automatic timestamps in log outputs.

Parameters:
strftime_format The date-time format to apply in outputs (strfime() syntax). Passing a NULL pointer will disable the feature.
See also:
MLog, MMaskedLog

void MMaskedLog int    level,
CARD32    mask,
const char *    fmt,
...   
 

Prints a formatted log string in the log window using the context mask.

You can call this function anywhere in your MGUI program, provided your calling method belongs to a class that inherits from CmMGUI. The log string is actually printed only if conditions for both the log-level and the context mask are satisfied.

Parameters:
level Log level associated with the call. For the string to be printed this value must be higher than or equal to the current log-level.
mask Context mask associated with the call. You can specify up to 32 different contexts for log masking. For the string to be printed this value must contain at least one bit of the current log-mask.
fmt A format string with sprintf syntax.
See also:
MLogInit, MLogSetLevel, MLog, MLogSetMask, MLogSetMaskBits, MLogResetMaskBits

void MSetTraceFileName const char *    fname
 

Sets the name of the file which to write low level tracing messages.

Parameters:
fname The name of the file to be created for low level tracing messages.
See also:
Trace, MLog, MMaskedLog

void MTraceSetTimeFormat const char *    strftime_format
 

Enables/disables automatic timestamps in trace outputs.

Parameters:
strftime_format The date-time format to apply in outputs (strfime() syntax). Passing a NULL pointer will disable the feature.
See also:
Trace

void Trace const char *    fmt,
...   
 

Prints a low level tracing message to the trace file.

Messages printed via this function are not directed to the log window. Rather they go directly to the trace file (default name is trace.log) created in the current directory of the program. The trace file is open, written and closed at any call to this function, so it's recommended to use it only for low level debugging in case the MLog() function is not suitable.

Parameters:
fmt A format string with sprintf syntax.
See also:
MSetTraceFileName, MLog, MMaskedLog


Generated on Sun Jun 29 13:03:09 2003 for MGui API by doxygen1.3-rc2