glib.Messages.Messages Class Reference

List of all members.

Detailed Description

Description These functions provide support for outputting messages.


Static Public Member Functions

static void print (char[] format,...)
 Outputs a formatted message via the print handler.
static GPrintFunc setPrintHandler (GPrintFunc func)
 Sets the print handler.
static void printerr (char[] format,...)
 Outputs a formatted message via the error message handler.
static GPrintFunc setPrinterrHandler (GPrintFunc func)
 Sets the handler for printing error messages.
static void onErrorQuery (char[] prgName)
 Prompts the user with [E]xit, [H]alt, show [S]tack trace or [P]roceed.
static void onErrorStackTrace (char[] prgName)
 Invokes gdb, which attaches to the current process and shows a stack trace.


Member Function Documentation

static void glib.Messages.Messages.onErrorQuery ( char[]  prgName  )  [static]

Prompts the user with [E]xit, [H]alt, show [S]tack trace or [P]roceed.

This function is intended to be used for debugging use only. The following example shows how it can be used together with the g_log() functions. include <glib.h> static void log_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data) { g_log_default_handler (log_domain, log_level, message, user_data); g_on_error_query (MY_PROGRAM_NAME); } int main (int argc, char *argv[]) { g_log_set_handler (MY_LOG_DOMAIN, G_LOG_LEVEL_WARNING | G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL, log_handler, NULL); /+* ... +/ If [E]xit is selected, the application terminates with a call to _exit(0). If [H]alt is selected, the application enters an infinite loop. The infinite loop can only be stopped by killing the application, or by setting glib_on_error_halt to FALSE (possibly via a debugger). If [S]tack trace is selected, g_on_error_stack_trace() is called. This invokes gdb, which attaches to the current process and shows a stack trace. The prompt is then shown again. If [P]roceed is selected, the function returns. This function may cause different actions on non-UNIX platforms. prg_name: the program name, needed by gdb for the [S]tack trace option. If prg_name is NULL, g_get_prgname() is called to get the program name (which will work correctly if gdk_init() or gtk_init() has been called).

static void glib.Messages.Messages.onErrorStackTrace ( char[]  prgName  )  [static]

Invokes gdb, which attaches to the current process and shows a stack trace.

Called by g_on_error_query() when the [S]tack trace option is selected. This function may cause different actions on non-UNIX platforms. prg_name: the program name, needed by gdb for the [S]tack trace option. If prg_name is NULL, g_get_prgname() is called to get the program name (which will work correctly if gdk_init() or gtk_init() has been called).

static void glib.Messages.Messages.print ( char[]  format,
  ... 
) [static]

Outputs a formatted message via the print handler.

The default print handler simply outputs the message to stdout. g_print() should not be used from within libraries for debugging messages, since it may be redirected by applications to special purpose message windows or even files. Instead, libraries should use g_log(), or the convenience functions g_message(), g_warning() and g_error(). format: the message format. See the printf() documentation. ...: the parameters to insert into the format string.

static void glib.Messages.Messages.printerr ( char[]  format,
  ... 
) [static]

Outputs a formatted message via the error message handler.

The default handler simply outputs the message to stderr. g_printerr() should not be used from within libraries. Instead g_log() should be used, or the convenience functions g_message(), g_warning() and g_error(). format: the message format. See the printf() documentation. ...: the parameters to insert into the format string.

static GPrintFunc glib.Messages.Messages.setPrinterrHandler ( GPrintFunc  func  )  [static]

Sets the handler for printing error messages.

Any messages passed to g_printerr() will be output via the new handler. The default handler simply outputs the message to stderr. By providing your own handler you can redirect the output, to a GTK+ widget or a log file for example. func: the new error message handler. Returns: the old error message handler.

static GPrintFunc glib.Messages.Messages.setPrintHandler ( GPrintFunc  func  )  [static]

Sets the print handler.

Any messages passed to g_print() will be output via the new handler. The default handler simply outputs the message to stdout. By providing your own handler you can redirect the output, to a GTK+ widget or a log file for example. func: the new print handler. Returns: the old print handler.


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