Exemplo n.º 1
0
void
test_target_level (void)
{
    cut_set_log_level(CUT_LOG_LEVEL_DEFAULT);

    logger = cut_logger_new();
    g_signal_connect(logger, "log",
                     G_CALLBACK(cut_logger_default_log_handler), NULL);

    original_print_hander = g_set_print_handler(print_handler);
    cut_logger_log(logger, "domain", CUT_LOG_LEVEL_INFO,
                   "file", 29, "function",
                   "message");
    g_set_print_handler(original_print_hander);
    original_print_hander = NULL;
    cut_assert_equal_string("", stdout_string->str);

    cut_logger_set_target_level(logger, CUT_LOG_LEVEL_INFO);
    original_print_hander = g_set_print_handler(print_handler);
    cut_logger_log(logger, "domain", CUT_LOG_LEVEL_INFO,
                   "file", 29, "function",
                   "message");
    g_set_print_handler(original_print_hander);
    original_print_hander = NULL;
    cut_assert_match("message", stdout_string->str);
}
Exemplo n.º 2
0
void
test_console_output (void)
{
    original_print_hander = g_set_print_handler(print_handler);
    cut_set_log_level(CUT_LOG_LEVEL_INFO);
    cut_log_info("info");
    cut_log_info("end-of-log");
    g_set_print_handler(original_print_hander);
    original_print_hander = NULL;

    cut_assert_match("info", stdout_string->str);
}
Exemplo n.º 3
0
int      S52_utils_initLog(S52_log_cb log_cb)
// set print handler
// set tmp log file
{
    //_shm_fd = shm_open(_shm_name, O_RDWR | O_CREAT | O_TRUNC, 0644 );

    // debug - setup trace log
    //g_setenv("MALLOC_TRACE", "mem.log", TRUE);

    if (NULL != log_cb) {
        log_cb("S52_utils_initLog(): init logging\n");
        _log_cb = log_cb;
    }

#ifdef S52_USE_LOGFILE
    GError *error = NULL;
    _logFile = g_file_open_tmp("XXXXXX", NULL, &error);
    if (-1 == _logFile) {
        PRINTF("WARNING: g_file_open_tmp(): failed\n");
    } else {
        PRINTF("DEBUG: logfile tmp dir:%s\n", g_get_tmp_dir());
    }
    if (NULL != error) {
        g_printf("WARNING: g_file_open_tmp() failed (%s)\n", error->message);
        g_error_free(error);
    }

    _oldPrintHandler = g_set_print_handler(_S52_printf);

#else
    PRINTF("DEBUG: no LOGFILE, compiler flags 'S52_USE_LOGFILE' not set\n");
#endif  // S52_USE_LOGFILE

    return TRUE;
}
Exemplo n.º 4
0
int
main (int   argc,
      char *argv[])
{
    int retval;

#ifdef __SYMBIAN32__
    g_log_set_handler (NULL,  G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, &mrtLogHandler, NULL);
    g_set_print_handler(mrtPrintHandler);
#endif /*__SYMBIAN32__*/

    if (argc > 1)
    {
        retval = test_file (argv[1]);
#ifdef __SYMBIAN32__
        testResultXml("markup-test");
#endif /* EMULATOR */
        return retval;
    }
    else
    {
        fprintf (stderr, "Give a markup file on the command line\n");
        return 1;
    }
}
Exemplo n.º 5
0
int main(int argc, char *argv[]) {
    g_print("Hello Word!\n");
    // 设置后g_print的打印会重定向log_file
    g_set_print_handler(log_file);
    g_print("Hello World set print!\n");
    return 0;
}
Exemplo n.º 6
0
int
main (int argc, char **argv)
{
  gint i;
  gint handle_id = 0;
  GTest *test;

  #ifdef SYMBIAN
 
  g_log_set_handler (NULL,  G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, &mrtLogHandler, NULL);
  g_set_print_handler(mrtPrintHandler);
  #endif /*SYMBIAN*/
	  

  g_type_init ();
  
  test = g_object_new (G_TYPE_TEST, NULL);
  if(!test)
  {
  	g_print("object_get_property.c : g_object_new is failed @ line : %d",__LINE__);
	g_assert(FALSE && "properties");
  }

  g_test_do_property (test);
  test_float_sink();
  

  //g_assert (count == test->dummy);
#ifdef SYMBIAN
  testResultXml("object_extra_tests");
#endif /* EMULATOR */

  return 0;
}
Exemplo n.º 7
0
//TODO sensible defaults
Log::Log(void)
: TextWindow(0, 0, 80, 24, NULL)
{
	conf = Conf::Instance();
/* Xerox */
#define REGISTER_G_LOG_HANDLER(name) \
        g_log_set_handler((name), (GLogLevelFlags)(G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL \
		| G_LOG_FLAG_RECURSION), \
		glib_log_handler_, NULL)

	SetBorder(new Border());
	max_lines = conf->GetLogMaxLines();
	MoveResize(conf->GetLogDimensions());

        /* Register the glib log handlers. */
        REGISTER_G_LOG_HANDLER(NULL);
        REGISTER_G_LOG_HANDLER("GLib");
        REGISTER_G_LOG_HANDLER("GModule");
        REGISTER_G_LOG_HANDLER("GLib-GObject");
        REGISTER_G_LOG_HANDLER("GThread");

	/* Redirect the debug messages to stderr */
	g_set_print_handler(glib_print_);   
        g_set_printerr_handler(glib_printerr_);

	/* Set the purple debug callbacks */
	purple_debug_set_ui_ops(&centerim_debug_ui_ops);
}
Exemplo n.º 8
0
void finch_debug_init()
{
/* Xerox */
#define REGISTER_G_LOG_HANDLER(name) \
	g_log_set_handler((name), G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL \
					  | G_LOG_FLAG_RECURSION, \
					  purple_glib_log_handler, NULL)

	/* Register the glib log handlers. */
	REGISTER_G_LOG_HANDLER(NULL);
	REGISTER_G_LOG_HANDLER("GLib");
	REGISTER_G_LOG_HANDLER("GModule");
	REGISTER_G_LOG_HANDLER("GLib-GObject");
	REGISTER_G_LOG_HANDLER("GThread");
	REGISTER_G_LOG_HANDLER("Gnt");
#ifdef USE_GSTREAMER
	REGISTER_G_LOG_HANDLER("GStreamer");
#endif
	REGISTER_G_LOG_HANDLER("stderr");

	g_set_print_handler(print_stderr);   /* Redirect the debug messages to stderr */
	if (!purple_debug_is_enabled())
		handle_fprintf_stderr(FALSE);

	purple_prefs_add_none(PREF_ROOT);
	purple_prefs_add_string(PREF_ROOT "/filter", "");
	purple_prefs_add_none(PREF_ROOT "/size");
	purple_prefs_add_int(PREF_ROOT "/size/width", 60);
	purple_prefs_add_int(PREF_ROOT "/size/height", 15);

	if (purple_debug_is_enabled())
		g_timeout_add(0, start_with_debugwin, NULL);
}
Exemplo n.º 9
0
int
main (int argc, char **argv)
{
  gint i;
  GTest *test;

  #ifdef SYMBIAN
  
  g_log_set_handler (NULL,  G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, &mrtLogHandler, NULL);
  g_set_print_handler(mrtPrintHandler);
  #endif /*SYMBIAN*/
	  

  g_thread_init (NULL);
  //g_print ("START: %s\n", argv[0]);
  g_log_set_always_fatal (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL | g_log_set_always_fatal (G_LOG_FATAL_MASK));
  g_type_init ();

  test = g_object_new (G_TYPE_TEST, NULL);
  
  g_assert(test != NULL);

  for (i=0; i<1000; i++) {
    g_test_do_refcount (test);
  }

  //g_print ("\n");
  
#ifdef SYMBIAN
  testResultXml("objects2");
#endif /* EMULATOR */
  return 0;
}
Exemplo n.º 10
0
xmlnode * _h_elim_init ( const char *name ,
                         const char *id   ,
                         SEXP_VALUE *args ,
                         gpointer data    )
{
    ASSERT_ALISTP( args, id, name );

    char    *dir = ALIST_VAL_STRING( args, "dot-dir" );
    char    *ui  = ALIST_VAL_STRING( args, "ui-id"   );
    gboolean dbg = ALIST_VAL_BOOL  ( args, "debug"   );

    if( !ui ) { ui = "elim"; }

    // libpurple initialisation:
    purple_util_set_user_dir       ( dir  );
    purple_util_init               ();
    purple_core_set_ui_ops         ( &elim_core_ui_ops         );
    purple_eventloop_set_ui_ops    ( &elim_eventloop_ui_ops    );
    purple_blist_set_ui_ops        ( &elim_blist_ui_ops        );
    purple_accounts_set_ui_ops     ( &elim_account_ui_ops      );
    purple_request_set_ui_ops      ( &elim_request_ui_ops      );
    purple_idle_set_ui_ops         ( &elim_idle_ui_ops         );
    purple_connections_set_ui_ops  ( &elim_connections_ui_ops  );
    purple_conversations_set_ui_ops( &elim_conversation_ui_ops );
    purple_notify_set_ui_ops       ( &elim_notify_ui_ops       );

    // load any data for init:    
    if( purple_get_core() == NULL )
    {
        // purple debug goes to stdout if we don't divert it here:
        g_set_print_handler( (GPrintFunc)_h_elim_warning );
        // look for plugins in user specified directory tree:
        char *ppath = g_build_filename( purple_user_dir(), "plugins", NULL );
        purple_plugins_add_search_path ( ppath );
        purple_debug_set_enabled( dbg );
        purple_core_init ( ui );
        purple_set_blist ( purple_blist_new() );
        purple_prefs_load();
        purple_blist_load();
        // glib signal initialisation:
        elim_ft_signals_init();
        // tidy up:
        g_free( ppath );
    }
    else
    {
        const char *cur_ui = purple_core_get_ui();
        if( strcmp( cur_ui, name ) )
        {
            sexp_val_free( args );
            return response_error( EINVAL, id, name, 
                                   "purple has already been initialised" );
        }
    }

    sexp_val_free( args );
    xmlnode *rval = xnode_new( "alist" );
    AL_STR( rval, "ui-id", purple_core_get_ui() );
    return response_value( 0, id, name, rval );
}
Exemplo n.º 11
0
void hello(GtkWidget *button, gpointer data)
{
	static gint count = 0;
	if(count > 3)
	{
		g_set_print_handler(NULL);
		count = 0;
	}
	else
	{
	//	g_set_print_handler(NULL);
		g_set_print_handler(my);
		count++;
	}
	g_print("hello,five times pased set g_print again to null in five clicked.\n");
}
Exemplo n.º 12
0
/**
 * mono_trace_set_printerr_handler:
 *
 * @callback The callback that will replace the default runtime behavior for stderr output.
 *
 * The print handler replaces the default runtime stderr output handler. This is used by free form output done by the runtime.
 *
 */
void
mono_trace_set_printerr_handler (MonoPrintCallback callback)
{
	g_assert (callback);
	printerr_callback = callback;
	g_set_print_handler (printerr_handler);
}
Exemplo n.º 13
0
int
main ()
{
  int i;

  #ifdef SYMBIAN
  g_log_set_handler (NULL,  G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, &mrtLogHandler, NULL);
  g_set_print_handler(mrtPrintHandler);
  #endif /*SYMBIAN*/
	  

  for (i = 0; i < SIZE; i++)
    array[i] = g_random_int ();

  g_qsort_with_data (array, SIZE, sizeof (guint32), sort, NULL);

  for (i = 0; i < SIZE - 1; i++)
    g_assert (array[i] <= array[i+1]);

  /* 0 elemenents is a valid case */
  g_qsort_with_data (array, 0, sizeof (guint32), sort, NULL);

#ifdef SYMBIAN
  testResultXml("qsort-test");
#endif /* EMULATOR */
  return 0;
}
Exemplo n.º 14
0
Arquivo: log.c Projeto: Hamakor/geany
void log_handlers_init(void)
{
	log_buffer = g_string_sized_new(2048);

	g_set_print_handler(handler_print);
	g_set_printerr_handler(handler_printerr);
	g_log_set_default_handler(handler_log, NULL);
}
Exemplo n.º 15
0
Logger::~Logger(void)
{
	g_log_set_default_handler(old_log_handler, NULL);
	g_set_print_handler(old_print_handler);
	if(h_log_file)
		fclose(h_log_file);
	destroy_flush_log_timer();
}
Exemplo n.º 16
0
int main (int argc, char *argv[])
{
  GCompletion *cmp;
  GList *items;
  gchar *prefix;
  
  #ifdef __SYMBIAN32__
  g_log_set_handler (NULL,  G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, &mrtLogHandler, NULL);
  g_set_print_handler(mrtPrintHandler);
  #endif /*__SYMBIAN32__*/
	  

  cmp = g_completion_new (NULL);

  items = NULL;
  items = g_list_append (items, "a\302\243");
  items = g_list_append (items, "a\302\244");
  items = g_list_append (items, "bb");
  items = g_list_append (items, "bc");
  g_completion_add_items (cmp, items);

  items = g_completion_complete (cmp, "a", &prefix);
  g_assert (!strcmp ("a\302", prefix));
  g_assert (g_list_length (items) == 2);
  g_free (prefix);
  
  items = g_completion_complete_utf8 (cmp, "a", &prefix);
  g_assert (!strcmp ("a", prefix));
  g_assert (g_list_length (items) == 2);
  g_free (prefix);

  items = g_completion_complete (cmp, "b", &prefix);
  g_assert (!strcmp ("b", prefix));
  g_assert (g_list_length (items) == 2);
  g_free (prefix);
  
  items = g_completion_complete_utf8 (cmp, "b", &prefix);
  g_assert (!strcmp ("b", prefix));
  g_assert (g_list_length (items) == 2);
  g_free (prefix);

  items = g_completion_complete (cmp, "a", NULL);
  g_assert (g_list_length (items) == 2);

  items = g_completion_complete_utf8 (cmp, "a", NULL);
  g_assert (g_list_length (items) == 2);

  g_completion_free (cmp);
  #if __SYMBIAN32__
  testResultXml("completion-test");
  #endif /* EMULATOR */

  return 0;
}
Exemplo n.º 17
0
int      S52_doneLog()
{
    g_set_print_handler(_oldPrintHandler);
    _err_cb = NULL;

#ifdef S52_USE_LOG
    if (0 != _log)
        close(_log);
#endif

    return TRUE;
}
Exemplo n.º 18
0
int      S52_doneLog()
{
    //S52_LOG("log finish");

    g_set_print_handler(_oldPrintHandler);
    if (0 != _log)
        close(_log);

    _err_cb = NULL;

    return TRUE;
}
Exemplo n.º 19
0
int
main (int   argc,
      char *argv[])
{
  GThread *threads[N_THREADS];
  int i;
  void *p;
    #ifdef __SYMBIAN32__
  g_log_set_handler (NULL,  G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, &mrtLogHandler, NULL);
  g_set_print_handler(mrtPrintHandler);
  #endif /*__SYMBIAN32__*/

  /* test simple initializer */
  initializer1();
  initializer1();
  /* test pointer initializer */
  /*void */p = initializer2();
  g_assert (p == &dummy_value);
  p = initializer2();
  g_assert (p == &dummy_value);
  /* setup threads */
  g_thread_init (NULL);
  tmutex = g_mutex_new ();
  tcond = g_cond_new ();
  /* start multiple threads for initializer3() */
  g_mutex_lock (tmutex);
  for (i = 0; i < N_THREADS; i++)
    threads[i] = g_thread_create (tmain_call_initializer3, 0, FALSE, NULL);
  g_mutex_unlock (tmutex);
  /* concurrently call initializer3() */
  g_cond_broadcast (tcond);
  /* loop until all threads passed the call to initializer3() */
  while (g_atomic_int_get (&thread_call_count) < i)
    {
      if (rand() % 2)
        g_thread_yield();   /* concurrent shuffling for single core */
      else
        g_usleep (1000);    /* concurrent shuffling for multi core */
      g_cond_broadcast (tcond);
    }
  /* call multiple (unoptimized) initializers from multiple threads */
  g_mutex_lock (tmutex);
  g_atomic_int_set (&thread_call_count, 0);
  for (i = 0; i < N_THREADS; i++)
    g_thread_create (stress_concurrent_initializers, 0, FALSE, NULL);
  g_mutex_unlock (tmutex);
  while (g_atomic_int_get (&thread_call_count) < 256 * 4 * N_THREADS)
    g_usleep (50 * 1000);       /* wait for all 5 threads to complete */
    #if __SYMBIAN32__
  testResultXml("onceinit");
  #endif /* EMULATOR */
  return 0;
}
Exemplo n.º 20
0
Logger::Logger(MessageLevel console_level, MessageLevel log_level)
:
console_message_level(console_level),
log_message_level(log_level),
old_print_handler(NULL),
old_log_handler(NULL),
h_log_file(NULL),
flush_log_timer(0)
{
	old_log_handler = g_log_set_default_handler(log_handler, NULL);
	old_print_handler = g_set_print_handler(print_handler);
	if(log_message_level > MessageLevel_NONE)
		open_log();
}
Exemplo n.º 21
0
EXPORT int check_plugin_init(int prio) {
	int argc = 0;
	char **argv = { NULL };

	g_set_print_handler(simple_errprint);
	g_set_printerr_handler(simple_errprint);
	g_log_set_default_handler(g_log_default_handler, NULL);

	g_test_init(&argc, &argv, NULL);

	add_recode_tests();

	g_test_run();
	ekg_exit();
	g_assert_not_reached();
}
Exemplo n.º 22
0
int main (int argc, char *argv[])
{

  #ifdef SYMBIAN
  g_log_set_handler (NULL,  G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, &mrtLogHandler, NULL);
  g_set_print_handler(mrtPrintHandler);
  #endif /*SYMBIAN*/
  
  test_utf8 (longline);
  test_length ();
  
 #ifdef SYMBIAN
  testResultXml("utf8-pointer");
  #endif //SYMBIAN
  
  return 0;
}
Exemplo n.º 23
0
void
teardown (void)
{
    if (logger)
        g_object_unref(logger);

    cut_set_log_level(original_log_level);
    if (default_handler_disconnected)
        cut_logger_connect_default_handler(cut_logger());

    if (original_print_hander)
        g_set_print_handler(original_print_hander);

    g_signal_handlers_disconnect_by_func(cut_logger(),
                                         G_CALLBACK(cb_log), NULL);
    g_string_free(stdout_string, TRUE);
}
Exemplo n.º 24
0
int
main (int   argc,
      char *argv[])
{

	#ifdef __SYMBIAN32__
  	g_log_set_handler (NULL, G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, &mrtLogHandler, NULL);
  	g_set_print_handler(mrtPrintHandler);
  	#endif

  run_tests ();
  
	#ifdef __SYMBIAN32__
  	testResultXml("spawn_test");
  	#endif /* EMULATOR */
	
  return 0;
}
Exemplo n.º 25
0
int
main (int argc, char *argv[])
{
#ifdef SYMBIAN
  g_log_set_handler (NULL,  G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, &mrtLogHandler, NULL);
  g_set_print_handler(mrtPrintHandler);
  #endif /*SYMBIAN*/
  g_type_init (); 
  
  test_param_spec_char ();
  test_param_spec_override ();
  test_param_spec_gtype ();
  
#ifdef SYMBIAN
testResultXml("paramspec-test");
#endif /*SYMBIAN*/
  return 0;
}
Exemplo n.º 26
0
int      S52_initLog(S52_error_cb err_cb)
{
    _err_cb = err_cb;

#ifdef S52_USE_LOG
    printf("starting log (%s)\n", g_get_tmp_dir());

    _log = g_file_open_tmp("XXXXXX", NULL, NULL);
    if (-1 == _log)
        g_assert(0);

    _oldPrintHandler = g_set_print_handler(S52_printf);
    //S52_LOG("log started");
#endif


    return TRUE;
}
Exemplo n.º 27
0
int main (int argc,char *argv[])
{
	#ifdef SYMBIAN
    g_log_set_handler (NULL,  G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, &mrtLogHandler, NULL);
	g_set_print_handler(mrtPrintHandler);
	#endif /*SYMBIAN*/
	
	printf("The following test case will abort\n when u press the enter key\n");
	printf("If you see any other message after \nthis message, consider the test\ncase as failed\n");
	getchar();
	
	g_log_set_fatal_mask(NULL,G_LOG_LEVEL_MESSAGE);
	
	g_log(NULL,G_LOG_LEVEL_MESSAGE,"test message");
	
	g_print("log_manual1 failed");
	
	getchar();
}
Exemplo n.º 28
0
int
main (int argc, char *argv[])
{
  #ifdef __SYMBIAN32__
  
  g_log_set_handler (NULL,  G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, &mrtLogHandler, NULL);
  g_set_print_handler(mrtPrintHandler);
  #endif /*__SYMBIAN32__*/
  g_type_init (); 
  
  test_enum_transformation ();
  test_gtype_value ();
  test_collection ();
  test_copying ();
  #if __SYMBIAN32__
  testResultXml("gvalue-test");
  #endif /* EMULATOR */

  return 0;
}
Exemplo n.º 29
0
void
gaim_gtk_debug_init(void)
{
	/* Debug window preferences. */
	/*
	 * NOTE: This must be set before prefs are loaded, and the callbacks
	 *       set after they are loaded, since prefs sets the enabled
	 *       preference here and that loads the window, which calls the
	 *       configure event, which overrides the width and height! :P
	 */

	gaim_prefs_add_none("/gaim/gtk/debug");
	gaim_prefs_add_bool("/gaim/gtk/debug/enabled", FALSE);
	gaim_prefs_add_bool("/gaim/gtk/debug/timestamps", FALSE);
	gaim_prefs_add_bool("/gaim/gtk/debug/toolbar", TRUE);
	gaim_prefs_add_int("/gaim/gtk/debug/width",  450);
	gaim_prefs_add_int("/gaim/gtk/debug/height", 250);

	gaim_prefs_connect_callback("/gaim/gtk/debug/enabled",
								debug_enabled_cb, NULL);

#define REGISTER_G_LOG_HANDLER(name) \
	g_log_set_handler((name), G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL \
					  | G_LOG_FLAG_RECURSION, \
					  gaim_glib_log_handler, NULL)

	/* Register the glib/gtk log handlers. */
	REGISTER_G_LOG_HANDLER(NULL);
	REGISTER_G_LOG_HANDLER("Gdk");
	REGISTER_G_LOG_HANDLER("Gtk");
	REGISTER_G_LOG_HANDLER("GdkPixbuf");
	REGISTER_G_LOG_HANDLER("GLib");
	REGISTER_G_LOG_HANDLER("GModule");
	REGISTER_G_LOG_HANDLER("GLib-GObject");
	REGISTER_G_LOG_HANDLER("GThread");

#ifdef _WIN32
	if (!opt_debug)
		g_set_print_handler(gaim_glib_dummy_print_handler);
#endif
}
Exemplo n.º 30
0
int      S52_initLog(S52_error_cb err_cb)
// set print handler
// set tmp log file
{
    _err_cb          = err_cb;

#ifdef S52_USE_LOG
    GError *error = NULL;
    _log = g_file_open_tmp("XXXXXX", NULL, &error);
    if (-1 == _log) {
        PRINTF("g_file_open_tmp(): failed\n");
    } else {
        PRINTF("tmp dir:%s\n", g_get_tmp_dir());
    }
    _oldPrintHandler = g_set_print_handler(_S52_printf);
#else
    PRINTF("NOTE: no LOG, compiler flags 'S52_USE_LOG' not set\n");
#endif

    return TRUE;
}