MessageLog

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.

Members

Static functions

logDefaultHandler
void logDefaultHandler(string logDomain, GLogLevelFlags logLevel, string message, void* unusedData)

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.

logRemoveHandler
void logRemoveHandler(string logDomain, uint handlerId)

Removes the log handler.

logSetAlwaysFatal
GLogLevelFlags logSetAlwaysFatal(GLogLevelFlags fatalMask)

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).

logSetDefaultHandler
GLogFunc logSetDefaultHandler(GLogFunc logFunc, void* userData)

Installs a default log handler which 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. Since 2.6

logSetFatalMask
GLogLevelFlags logSetFatalMask(string logDomain, GLogLevelFlags fatalMask)

Sets the log levels which are fatal in the given domain. G_LOG_LEVEL_ERROR is always fatal.

logSetHandler
uint logSetHandler(string logDomain, GLogLevelFlags logLevels, GLogFunc logFunc, void* userData)

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.

logv
void logv(string logDomain, GLogLevelFlags logLevel, string format, void* args)

Logs an error or debugging message. If the log level has been set as fatal, the abort() function is called to terminate the program.

Meta