glib.MessageLog.MessageLog Class Reference

List of all members.

Detailed Description

Description These functions provide support for logging error messages or messages used for debugging.

There are several built-in levels of messages, defined in GLogLevelFlags. These can be extended with user-defined levels.


Static Public Member Functions

static void log (char[] logDomain, GLogLevelFlags logLevel, char[] format,...)
 Logs an error or debugging message.
static void logv (char[] logDomain, GLogLevelFlags logLevel, char[] format, void *args)
 Logs an error or debugging message.
static uint logSetHandler (char[] logDomain, GLogLevelFlags logLevels, GLogFunc logFunc, void *userData)
 Sets the log handler for a domain and a set of log levels.
static void logRemoveHandler (char[] logDomain, uint handlerId)
 Removes the log handler.
static GLogLevelFlags logSetAlwaysFatal (GLogLevelFlags fatalMask)
 Sets the message levels which are always fatal, in any log domain.
static GLogLevelFlags logSetFatalMask (char[] logDomain, GLogLevelFlags fatalMask)
 Sets the log levels which are fatal in the given domain.
static void logDefaultHandler (char[] logDomain, GLogLevelFlags logLevel, char[] message, void *unusedData)
 The default log handler set up by GLib; g_log_set_default_handler() allows to install an alternate default log handler.
static GLogFunc logSetDefaultHandler (GLogFunc logFunc, void *userData)
 Installs a default log handler which is used is used if no log handler has been set for the particular log domain and log level combination.


Member Function Documentation

static void glib.MessageLog.MessageLog.log ( char[]  logDomain,
GLogLevelFlags  logLevel,
char[]  format,
  ... 
) [static]

Logs an error or debugging message.

If the log level has been set as fatal, the abort() function is called to terminate the program. log_domain: the log domain, usually G_LOG_DOMAIN. log_level: the log level, either from GLogLevelFlags or a user-defined level. format: the message format. See the printf() documentation. ...: the parameters to insert into the format string.

static void glib.MessageLog.MessageLog.logDefaultHandler ( char[]  logDomain,
GLogLevelFlags  logLevel,
char[]  message,
void *  unusedData 
) [static]

The default log handler set up by GLib; g_log_set_default_handler() allows to install an alternate default log handler.

This is used if no log handler has been set for the particular log domain and log level combination. It outputs the message to stderr or stdout and if the log level is fatal it calls abort(). stderr is used for levels G_LOG_LEVEL_ERROR, G_LOG_LEVEL_CRITICAL, G_LOG_LEVEL_WARNING and G_LOG_LEVEL_MESSAGE. stdout is used for the rest. log_domain: the log domain of the message. log_level: the level of the message. message: the message. unused_data: data passed from g_log() which is unused.

static void glib.MessageLog.MessageLog.logRemoveHandler ( char[]  logDomain,
uint  handlerId 
) [static]

Removes the log handler.

log_domain: the log domain. handler_id: the id of the handler, which was returned in g_log_set_handler().

static GLogLevelFlags glib.MessageLog.MessageLog.logSetAlwaysFatal ( GLogLevelFlags  fatalMask  )  [static]

Sets the message levels which are always fatal, in any log domain.

When a message with any of these levels is logged the program terminates. You can only set the levels defined by GLib to be fatal. G_LOG_LEVEL_ERROR is always fatal. You can also make some message levels fatal at runtime by setting the G_DEBUG environment variable (see Running GLib Applications). fatal_mask: the mask containing bits set for each level of error which is to be fatal. Returns: the old fatal mask.

static GLogFunc glib.MessageLog.MessageLog.logSetDefaultHandler ( GLogFunc  logFunc,
void *  userData 
) [static]

Installs a default log handler which is used is used if no log handler has been set for the particular log domain and log level combination.

By default, GLib uses g_log_default_handler() as default log handler. log_func: the log handler function. user_data: data passed to the log handler. Returns: the previous default log handler Since 2.6

static GLogLevelFlags glib.MessageLog.MessageLog.logSetFatalMask ( char[]  logDomain,
GLogLevelFlags  fatalMask 
) [static]

Sets the log levels which are fatal in the given domain.

G_LOG_LEVEL_ERROR is always fatal. log_domain: the log domain. fatal_mask: the new fatal mask. Returns: the old fatal mask for the log domain.

static uint glib.MessageLog.MessageLog.logSetHandler ( char[]  logDomain,
GLogLevelFlags  logLevels,
GLogFunc  logFunc,
void *  userData 
) [static]

Sets the log handler for a domain and a set of log levels.

To handle fatal and recursive messages the log_levels parameter must be combined with the G_LOG_FLAG_FATAL and G_LOG_FLAG_RECURSION bit flags. Note that since the G_LOG_LEVEL_ERROR log level is always fatal, if you want to set a handler for this log level you must combine it with G_LOG_FLAG_FATAL. Example13.Adding a log handler for all warning messages in the default (application) domain g_log_set_handler (NULL, G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, my_log_handler, NULL); Example14.Adding a log handler for all critical messages from GTK+ g_log_set_handler ("Gtk", G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, my_log_handler, NULL); Example15.Adding a log handler for all messages from GLib g_log_set_handler ("GLib", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, my_log_handler, NULL); log_domain: the log domain, or NULL for the default "" application domain. log_levels: the log levels to apply the log handler for. To handle fatal and recursive messages as well, combine the log levels with the G_LOG_FLAG_FATAL and G_LOG_FLAG_RECURSION bit flags. log_func: the log handler function. user_data: data passed to the log handler. Returns: the id of the new handler.

static void glib.MessageLog.MessageLog.logv ( char[]  logDomain,
GLogLevelFlags  logLevel,
char[]  format,
void *  args 
) [static]

Logs an error or debugging message.

If the log level has been set as fatal, the abort() function is called to terminate the program. log_domain: the log domain. log_level: the log level. format: the message format. See the printf() documentation. args: the parameters to insert into the format string.


SourceForge.net Logo DSource.org Logo digitalmars.com Logo