You can try setting the environment variable G_DEBUGas indicated on the developer's site GLib. See the Environment variablesection Running and debugging GLib Applicationsat http://developer.gnome.org/glib/2.28/glib-running.html .
EDIT: , .
g_log_set_handler (http://developer.gnome.org/glib/2.29/glib-Message-Logging.html#g-log-set-handler), . , , g_log_default_handler , . , GLogLevelFlags .
, .
#include <glib.h>
#include <stdio.h>
#include <string.h>
#define G_LOG_DOMAIN ((gchar*) 0)
static void _dummy(const gchar *log_domain,
GLogLevelFlags log_level,
const gchar *message,
gpointer user_data )
{
return ;
}
int main(int argc, char **argv)
{
g_log_set_handler(G_LOG_DOMAIN, G_LOG_LEVEL_MASK, _dummy, NULL);
if ( argc > 1)
{
if(!strncmp("-vv", argv[1], 3))
{
g_log_set_handler(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, g_log_default_handler, NULL);
}
else if(!strncmp("-v", argv[1], 2))
{
g_log_set_handler(G_LOG_DOMAIN, G_LOG_LEVEL_INFO, g_log_default_handler, NULL);
}
else
{
g_log_set_handler(G_LOG_DOMAIN, G_LOG_LEVEL_MASK, g_log_default_handler, NULL);
}
}
else
{
g_log_set_handler(G_LOG_DOMAIN, G_LOG_LEVEL_WARNING| G_LOG_LEVEL_CRITICAL, g_log_default_handler, NULL);
}
g_warning("This is warning\n");
g_message("This is message\n");
g_debug("This is debug\n");
g_critical("This is critical\n");
g_log(NULL, G_LOG_LEVEL_INFO , "This is info\n");
return 0;
}
, !