1998-06-11 01:21:14 +02:00
|
|
|
/* GLIB - Library of useful routines for C programming
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2000-07-26 13:02:02 +02:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1998-06-11 01:21:14 +02:00
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2000-07-26 13:02:02 +02:00
|
|
|
* Lesser General Public License for more details.
|
1998-06-11 01:21:14 +02:00
|
|
|
*
|
2000-07-26 13:02:02 +02:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
1998-06-11 01:21:14 +02:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
1998-11-01 05:19:54 +01:00
|
|
|
|
1999-02-24 07:14:27 +01:00
|
|
|
/*
|
2000-07-26 13:02:02 +02:00
|
|
|
* Modified by the GLib Team and others 1997-2000. See the AUTHORS
|
1999-02-24 07:14:27 +01:00
|
|
|
* file for a list of people on the GLib Team. See the ChangeLog
|
|
|
|
* files for a list of changes. These files are distributed with
|
2010-09-04 02:51:08 +02:00
|
|
|
* GLib at ftp://ftp.gtk.org/pub/gtk/.
|
1999-02-24 07:14:27 +01:00
|
|
|
*/
|
|
|
|
|
2010-09-04 02:51:08 +02:00
|
|
|
/*
|
1998-12-15 06:28:02 +01:00
|
|
|
* MT safe
|
|
|
|
*/
|
|
|
|
|
2011-07-20 02:40:28 +02:00
|
|
|
/**
|
|
|
|
* SECTION:warnings
|
|
|
|
* @Title: Message Output and Debugging Functions
|
|
|
|
* @Short_description: functions to output messages and help debug applications
|
|
|
|
*
|
|
|
|
* These functions provide support for outputting messages.
|
|
|
|
*
|
|
|
|
* The <function>g_return</function> family of macros (g_return_if_fail(),
|
|
|
|
* g_return_val_if_fail(), g_return_if_reached(), g_return_val_if_reached())
|
|
|
|
* should only be used for programming errors, a typical use case is
|
|
|
|
* checking for invalid parameters at the beginning of a public function.
|
|
|
|
* They should not be used if you just mean "if (error) return", they
|
|
|
|
* should only be used if you mean "if (bug in program) return".
|
|
|
|
* The program behavior is generally considered undefined after one
|
|
|
|
* of these checks fails. They are not intended for normal control
|
|
|
|
* flow, only to give a perhaps-helpful warning before giving up.
|
|
|
|
*/
|
|
|
|
|
2002-12-04 02:27:44 +01:00
|
|
|
#include "config.h"
|
1998-11-01 05:19:54 +01:00
|
|
|
|
1998-09-07 11:43:54 +02:00
|
|
|
#include <stdlib.h>
|
1998-06-11 01:21:14 +02:00
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
1999-09-14 00:17:27 +02:00
|
|
|
#include <signal.h>
|
1999-10-12 14:08:13 +02:00
|
|
|
#include <locale.h>
|
|
|
|
#include <errno.h>
|
2002-12-04 02:27:44 +01:00
|
|
|
|
2013-05-20 15:31:48 +02:00
|
|
|
#include "gmessages-private.h"
|
2010-09-04 02:51:08 +02:00
|
|
|
|
2011-10-17 00:43:22 +02:00
|
|
|
#include "glib-init.h"
|
2010-09-04 02:51:08 +02:00
|
|
|
#include "gbacktrace.h"
|
2011-10-17 00:43:22 +02:00
|
|
|
#include "gcharset.h"
|
2010-09-04 02:51:08 +02:00
|
|
|
#include "gconvert.h"
|
2011-11-03 06:48:54 +01:00
|
|
|
#include "genviron.h"
|
2010-09-04 02:51:08 +02:00
|
|
|
#include "gmem.h"
|
|
|
|
#include "gprintfint.h"
|
|
|
|
#include "gtestutils.h"
|
|
|
|
#include "gthread.h"
|
|
|
|
#include "gstrfuncs.h"
|
|
|
|
#include "gstring.h"
|
2012-07-30 22:05:08 +02:00
|
|
|
#include "gpattern.h"
|
2010-09-04 02:51:08 +02:00
|
|
|
|
Replace #ifdef HAVE_UNISTD_H checks with #ifdef G_OS_UNIX
In Windows development environments that have it, <unistd.h> is mostly
just a wrapper around several other native headers (in particular,
<io.h>, which contains read(), close(), etc, and <process.h>, which
contains getpid()). But given that some Windows dev environments don't
have <unistd.h>, everything that uses those functions on Windows
already needed to include the correct Windows header as well, and so
there is never any point to including <unistd.h> on Windows.
Also, remove some <unistd.h> includes (and a few others) that were
unnecessary even on unix.
https://bugzilla.gnome.org/show_bug.cgi?id=710519
2013-10-19 19:04:00 +02:00
|
|
|
#ifdef G_OS_UNIX
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
2010-11-09 02:53:12 +01:00
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
#include <process.h> /* For getpid() */
|
|
|
|
#include <io.h>
|
|
|
|
# define _WIN32_WINDOWS 0x0401 /* to get IsDebuggerPresent */
|
|
|
|
# include <windows.h>
|
|
|
|
#endif
|
|
|
|
|
2010-09-04 02:51:08 +02:00
|
|
|
|
2011-10-13 04:29:18 +02:00
|
|
|
/**
|
|
|
|
* SECTION:messages
|
|
|
|
* @title: Message Logging
|
|
|
|
* @short_description: versatile support for logging messages
|
|
|
|
* with different levels of importance
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* G_LOG_DOMAIN:
|
|
|
|
*
|
|
|
|
* Defines the log domain.
|
|
|
|
*
|
|
|
|
* For applications, this is typically left as the default %NULL
|
|
|
|
* (or "") domain. Libraries should define this so that any messages
|
|
|
|
* which they log can be differentiated from messages from other
|
|
|
|
* libraries and application code. But be careful not to define
|
|
|
|
* it in any public header files.
|
|
|
|
*
|
|
|
|
* For example, GTK+ uses this in its Makefile.am:
|
|
|
|
* |[
|
|
|
|
* INCLUDES = -DG_LOG_DOMAIN=\"Gtk\"
|
|
|
|
* ]|
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* G_LOG_FATAL_MASK:
|
|
|
|
*
|
|
|
|
* GLib log levels that are considered fatal by default.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GLogFunc:
|
|
|
|
* @log_domain: the log domain of the message
|
|
|
|
* @log_level: the log level of the message (including the
|
|
|
|
* fatal and recursion flags)
|
|
|
|
* @message: the message to process
|
|
|
|
* @user_data: user data, set in g_log_set_handler()
|
|
|
|
*
|
|
|
|
* Specifies the prototype of log handler functions.
|
2013-10-21 16:09:13 +02:00
|
|
|
*
|
|
|
|
* The default log handler, g_log_default_handler(), automatically appends a
|
|
|
|
* new-line character to @message when printing it. It is advised that any
|
|
|
|
* custom log handler functions behave similarly, so that logging calls in user
|
|
|
|
* code do not need modifying to add a new-line character to the message if the
|
|
|
|
* log handler is changed.
|
2011-10-13 04:29:18 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GLogLevelFlags:
|
|
|
|
* @G_LOG_FLAG_RECURSION: internal flag
|
|
|
|
* @G_LOG_FLAG_FATAL: internal flag
|
|
|
|
* @G_LOG_LEVEL_ERROR: log level for errors, see g_error().
|
|
|
|
* This level is also used for messages produced by g_assert().
|
|
|
|
* @G_LOG_LEVEL_CRITICAL: log level for critical messages, see g_critical().
|
|
|
|
* This level is also used for messages produced by g_return_if_fail()
|
|
|
|
* and g_return_val_if_fail().
|
|
|
|
* @G_LOG_LEVEL_WARNING: log level for warnings, see g_warning()
|
|
|
|
* @G_LOG_LEVEL_MESSAGE: log level for messages, see g_message()
|
2013-10-29 21:30:06 +01:00
|
|
|
* @G_LOG_LEVEL_INFO: log level for informational messages, see g_info()
|
2011-10-13 04:29:18 +02:00
|
|
|
* @G_LOG_LEVEL_DEBUG: log level for debug messages, see g_debug()
|
|
|
|
* @G_LOG_LEVEL_MASK: a mask including all log levels
|
|
|
|
*
|
|
|
|
* Flags specifying the level of log messages.
|
|
|
|
*
|
|
|
|
* It is possible to change how GLib treats messages of the various
|
|
|
|
* levels using g_log_set_handler() and g_log_set_fatal_mask().
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* g_message:
|
|
|
|
* @...: format string, followed by parameters to insert
|
|
|
|
* into the format string (as with printf())
|
|
|
|
*
|
|
|
|
* A convenience function/macro to log a normal message.
|
2013-10-21 16:09:13 +02:00
|
|
|
*
|
|
|
|
* If g_log_default_handler() is used as the log handler function, a new-line
|
|
|
|
* character will automatically be appended to @..., and need not be entered
|
|
|
|
* manually.
|
2011-10-13 04:29:18 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* g_warning:
|
|
|
|
* @...: format string, followed by parameters to insert
|
|
|
|
* into the format string (as with printf())
|
|
|
|
*
|
|
|
|
* A convenience function/macro to log a warning message.
|
|
|
|
*
|
|
|
|
* You can make warnings fatal at runtime by setting the
|
2011-12-14 05:00:16 +01:00
|
|
|
* <envar>G_DEBUG</envar> environment variable (see
|
2011-10-13 04:29:18 +02:00
|
|
|
* <ulink url="glib-running.html">Running GLib Applications</ulink>).
|
2013-10-21 16:09:13 +02:00
|
|
|
*
|
|
|
|
* If g_log_default_handler() is used as the log handler function, a new-line
|
|
|
|
* character will automatically be appended to @..., and need not be entered
|
|
|
|
* manually.
|
2011-10-13 04:29:18 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* g_critical:
|
|
|
|
* @...: format string, followed by parameters to insert
|
|
|
|
* into the format string (as with printf())
|
|
|
|
*
|
|
|
|
* Logs a "critical warning" (#G_LOG_LEVEL_CRITICAL).
|
|
|
|
* It's more or less application-defined what constitutes
|
|
|
|
* a critical vs. a regular warning. You could call
|
|
|
|
* g_log_set_always_fatal() to make critical warnings exit
|
|
|
|
* the program, then use g_critical() for fatal errors, for
|
|
|
|
* example.
|
|
|
|
*
|
|
|
|
* You can also make critical warnings fatal at runtime by
|
2011-12-14 05:00:16 +01:00
|
|
|
* setting the <envar>G_DEBUG</envar> environment variable (see
|
2011-10-13 04:29:18 +02:00
|
|
|
* <ulink url="glib-running.html">Running GLib Applications</ulink>).
|
2013-10-21 16:09:13 +02:00
|
|
|
*
|
|
|
|
* If g_log_default_handler() is used as the log handler function, a new-line
|
|
|
|
* character will automatically be appended to @..., and need not be entered
|
|
|
|
* manually.
|
2011-10-13 04:29:18 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* g_error:
|
|
|
|
* @...: format string, followed by parameters to insert
|
|
|
|
* into the format string (as with printf())
|
|
|
|
*
|
|
|
|
* A convenience function/macro to log an error message.
|
|
|
|
*
|
|
|
|
* Error messages are always fatal, resulting in a call to
|
|
|
|
* abort() to terminate the application. This function will
|
|
|
|
* result in a core dump; don't use it for errors you expect.
|
|
|
|
* Using this function indicates a bug in your program, i.e.
|
|
|
|
* an assertion failure.
|
|
|
|
*
|
2013-10-21 16:09:13 +02:00
|
|
|
* If g_log_default_handler() is used as the log handler function, a new-line
|
|
|
|
* character will automatically be appended to @..., and need not be entered
|
|
|
|
* manually.
|
|
|
|
*
|
2011-10-13 04:29:18 +02:00
|
|
|
*/
|
|
|
|
|
2013-10-29 21:30:06 +01:00
|
|
|
/**
|
|
|
|
* g_info:
|
|
|
|
* @...: format string, followed by parameters to insert
|
|
|
|
* into the format string (as with printf())
|
|
|
|
*
|
|
|
|
* A convenience function/macro to log an informational message. Seldom used.
|
|
|
|
*
|
|
|
|
* If g_log_default_handler() is used as the log handler function, a new-line
|
|
|
|
* character will automatically be appended to @..., and need not be entered
|
|
|
|
* manually.
|
|
|
|
*
|
|
|
|
* Such messages are suppressed by the g_log_default_handler() unless
|
|
|
|
* the G_MESSAGES_DEBUG environment variable is set appropriately.
|
|
|
|
*
|
|
|
|
* Since: 2.40
|
|
|
|
*/
|
|
|
|
|
2011-10-13 04:29:18 +02:00
|
|
|
/**
|
|
|
|
* g_debug:
|
|
|
|
* @...: format string, followed by parameters to insert
|
|
|
|
* into the format string (as with printf())
|
|
|
|
*
|
|
|
|
* A convenience function/macro to log a debug message.
|
|
|
|
*
|
2013-10-21 16:09:13 +02:00
|
|
|
* If g_log_default_handler() is used as the log handler function, a new-line
|
|
|
|
* character will automatically be appended to @..., and need not be entered
|
|
|
|
* manually.
|
|
|
|
*
|
2013-10-29 21:30:06 +01:00
|
|
|
* Such messages are suppressed by the g_log_default_handler() unless
|
|
|
|
* the G_MESSAGES_DEBUG environment variable is set appropriately.
|
|
|
|
*
|
2011-10-13 04:29:18 +02:00
|
|
|
* Since: 2.6
|
|
|
|
*/
|
|
|
|
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
/* --- structures --- */
|
|
|
|
typedef struct _GLogDomain GLogDomain;
|
|
|
|
typedef struct _GLogHandler GLogHandler;
|
|
|
|
struct _GLogDomain
|
1998-06-11 01:21:14 +02:00
|
|
|
{
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
gchar *log_domain;
|
|
|
|
GLogLevelFlags fatal_mask;
|
|
|
|
GLogHandler *handlers;
|
|
|
|
GLogDomain *next;
|
|
|
|
};
|
|
|
|
struct _GLogHandler
|
|
|
|
{
|
|
|
|
guint id;
|
|
|
|
GLogLevelFlags log_level;
|
|
|
|
GLogFunc log_func;
|
|
|
|
gpointer data;
|
|
|
|
GLogHandler *next;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* --- variables --- */
|
2011-10-03 02:51:38 +02:00
|
|
|
static GMutex g_messages_lock;
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
static GLogDomain *g_log_domains = NULL;
|
|
|
|
static GPrintFunc glib_print_func = NULL;
|
|
|
|
static GPrintFunc glib_printerr_func = NULL;
|
2011-09-18 07:10:07 +02:00
|
|
|
static GPrivate g_log_depth;
|
2013-05-20 15:31:48 +02:00
|
|
|
static gboolean exit_on_fatal;
|
2004-09-05 07:46:33 +02:00
|
|
|
static GLogFunc default_log_func = g_log_default_handler;
|
|
|
|
static gpointer default_log_data = NULL;
|
2009-09-10 16:40:11 +02:00
|
|
|
static GTestLogFatalFunc fatal_log_func = NULL;
|
|
|
|
static gpointer fatal_log_data;
|
1998-12-15 06:28:02 +01:00
|
|
|
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
/* --- functions --- */
|
2013-05-20 15:31:48 +02:00
|
|
|
|
|
|
|
void
|
|
|
|
_g_log_abort (void)
|
|
|
|
{
|
|
|
|
if (exit_on_fatal)
|
|
|
|
_exit (1);
|
|
|
|
else
|
|
|
|
abort ();
|
|
|
|
}
|
|
|
|
|
1999-10-12 14:08:13 +02:00
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
# include <windows.h>
|
2002-03-27 18:57:30 +01:00
|
|
|
static gboolean win32_keep_fatal_message = FALSE;
|
2000-12-25 23:07:01 +01:00
|
|
|
|
|
|
|
/* This default message will usually be overwritten. */
|
2004-09-22 23:15:35 +02:00
|
|
|
/* Yes, a fixed size buffer is bad. So sue me. But g_error() is never
|
|
|
|
* called with huge strings, is it?
|
2002-03-27 18:57:30 +01:00
|
|
|
*/
|
|
|
|
static gchar fatal_msg_buf[1000] = "Unspecified fatal error encountered, aborting.";
|
|
|
|
static gchar *fatal_msg_ptr = fatal_msg_buf;
|
2000-12-25 23:07:01 +01:00
|
|
|
|
1999-10-12 14:08:13 +02:00
|
|
|
#undef write
|
|
|
|
static inline int
|
2004-09-22 23:15:35 +02:00
|
|
|
dowrite (int fd,
|
Warn if no callback. Call callback correctly. (g_io_win32_create_watch):
2000-12-14 Tor Lillqvist <tml@iki.fi>
* giowin32.c (g_io_win32_dispatch): Warn if no callback. Call
callback correctly.
(g_io_win32_create_watch): Fix typo.
(g_io_win32_fd_create_watch): Ditto.
(g_io_channel_unix_new): If it is a file descriptor (i.e., a Unix
fd lookalike provided by the C library), call
g_io_channel_win32_new_fd(). If it is a socket (from WinSock),
call g_io_cahnnel_win32_new_stream_socket(). Hopefully sockets and
fds don't overlap. TODO: Implement also datagram sockets.
(g_io_channel_win32_poll): Call g_main_context_get_poll_func().
* gcompletion.h: Include <unistd.h> only on Unix. Is this
inclusion really needed here? OTOH, do include <stddef.h>, for
size_t.
* gmessages.c: (Win32) Don't define a function called "write" that
might clash with the prototype from <io.h>, use a #define.
* glib.def: Update.
* gmain.c (g_source_add_poll): Don't return a value from void
function.
(g_main_context_get_poll_func): Compile also for non-Win32, as
presumably was intended. The result var is a GPollFunc, not a
GPollFunc*. Return the result!
gobject:
2000-12-14 Tor Lillqvist <tml@iki.fi>
* makefile.mingw.in: Update, include parts from Makefile.am to
build gmarshal.[ch]. Some day, we won't need these separate
makefiles for Win32 compilation. I hope.
* makefile.msc.in: Update. No use trying to build gmarshal.[ch]
here, it would require Unixish tools. MSVC users building from CVS
sources are out of luck.
* gobject.def: Update.
2000-12-14 22:02:20 +01:00
|
|
|
const void *buf,
|
|
|
|
unsigned int len)
|
1999-10-12 14:08:13 +02:00
|
|
|
{
|
2002-03-27 18:57:30 +01:00
|
|
|
if (win32_keep_fatal_message)
|
2000-12-25 23:07:01 +01:00
|
|
|
{
|
|
|
|
memcpy (fatal_msg_ptr, buf, len);
|
|
|
|
fatal_msg_ptr += len;
|
|
|
|
*fatal_msg_ptr = 0;
|
|
|
|
return len;
|
|
|
|
}
|
|
|
|
|
2004-09-22 23:15:35 +02:00
|
|
|
write (fd, buf, len);
|
1999-10-12 14:08:13 +02:00
|
|
|
|
|
|
|
return len;
|
|
|
|
}
|
Warn if no callback. Call callback correctly. (g_io_win32_create_watch):
2000-12-14 Tor Lillqvist <tml@iki.fi>
* giowin32.c (g_io_win32_dispatch): Warn if no callback. Call
callback correctly.
(g_io_win32_create_watch): Fix typo.
(g_io_win32_fd_create_watch): Ditto.
(g_io_channel_unix_new): If it is a file descriptor (i.e., a Unix
fd lookalike provided by the C library), call
g_io_channel_win32_new_fd(). If it is a socket (from WinSock),
call g_io_cahnnel_win32_new_stream_socket(). Hopefully sockets and
fds don't overlap. TODO: Implement also datagram sockets.
(g_io_channel_win32_poll): Call g_main_context_get_poll_func().
* gcompletion.h: Include <unistd.h> only on Unix. Is this
inclusion really needed here? OTOH, do include <stddef.h>, for
size_t.
* gmessages.c: (Win32) Don't define a function called "write" that
might clash with the prototype from <io.h>, use a #define.
* glib.def: Update.
* gmain.c (g_source_add_poll): Don't return a value from void
function.
(g_main_context_get_poll_func): Compile also for non-Win32, as
presumably was intended. The result var is a GPollFunc, not a
GPollFunc*. Return the result!
gobject:
2000-12-14 Tor Lillqvist <tml@iki.fi>
* makefile.mingw.in: Update, include parts from Makefile.am to
build gmarshal.[ch]. Some day, we won't need these separate
makefiles for Win32 compilation. I hope.
* makefile.msc.in: Update. No use trying to build gmarshal.[ch]
here, it would require Unixish tools. MSVC users building from CVS
sources are out of luck.
* gobject.def: Update.
2000-12-14 22:02:20 +01:00
|
|
|
#define write(fd, buf, len) dowrite(fd, buf, len)
|
|
|
|
|
1999-10-12 14:08:13 +02:00
|
|
|
#endif
|
2001-05-09 18:36:17 +02:00
|
|
|
|
2001-05-14 16:53:59 +02:00
|
|
|
static void
|
2004-09-22 23:15:35 +02:00
|
|
|
write_string (int fd,
|
|
|
|
const gchar *string)
|
2001-05-14 16:53:59 +02:00
|
|
|
{
|
2012-08-29 17:44:01 +02:00
|
|
|
int res;
|
|
|
|
do
|
|
|
|
res = write (fd, string, strlen (string));
|
|
|
|
while (G_UNLIKELY (res == -1 && errno == EINTR));
|
2001-05-14 16:53:59 +02:00
|
|
|
}
|
|
|
|
|
2002-03-27 18:57:30 +01:00
|
|
|
static GLogDomain*
|
|
|
|
g_log_find_domain_L (const gchar *log_domain)
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
{
|
|
|
|
register GLogDomain *domain;
|
1998-12-15 06:28:02 +01:00
|
|
|
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
domain = g_log_domains;
|
|
|
|
while (domain)
|
1998-06-11 01:21:14 +02:00
|
|
|
{
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
if (strcmp (domain->log_domain, log_domain) == 0)
|
2002-03-14 17:20:42 +01:00
|
|
|
return domain;
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
domain = domain->next;
|
1998-06-11 01:21:14 +02:00
|
|
|
}
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2002-03-27 18:57:30 +01:00
|
|
|
static GLogDomain*
|
|
|
|
g_log_domain_new_L (const gchar *log_domain)
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
{
|
|
|
|
register GLogDomain *domain;
|
1998-08-17 02:00:51 +02:00
|
|
|
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
domain = g_new (GLogDomain, 1);
|
|
|
|
domain->log_domain = g_strdup (log_domain);
|
|
|
|
domain->fatal_mask = G_LOG_FATAL_MASK;
|
|
|
|
domain->handlers = NULL;
|
1998-12-15 06:28:02 +01:00
|
|
|
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
domain->next = g_log_domains;
|
|
|
|
g_log_domains = domain;
|
|
|
|
|
|
|
|
return domain;
|
|
|
|
}
|
1998-06-11 01:21:14 +02:00
|
|
|
|
2002-03-27 18:57:30 +01:00
|
|
|
static void
|
|
|
|
g_log_domain_check_free_L (GLogDomain *domain)
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
{
|
|
|
|
if (domain->fatal_mask == G_LOG_FATAL_MASK &&
|
|
|
|
domain->handlers == NULL)
|
1998-06-11 01:21:14 +02:00
|
|
|
{
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
register GLogDomain *last, *work;
|
|
|
|
|
1998-12-15 06:28:02 +01:00
|
|
|
last = NULL;
|
|
|
|
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
work = g_log_domains;
|
|
|
|
while (work)
|
|
|
|
{
|
|
|
|
if (work == domain)
|
|
|
|
{
|
|
|
|
if (last)
|
|
|
|
last->next = domain->next;
|
|
|
|
else
|
|
|
|
g_log_domains = domain->next;
|
|
|
|
g_free (domain->log_domain);
|
|
|
|
g_free (domain);
|
|
|
|
break;
|
|
|
|
}
|
2000-08-06 20:09:32 +02:00
|
|
|
last = work;
|
|
|
|
work = last->next;
|
1998-12-15 06:28:02 +01:00
|
|
|
}
|
1998-06-11 01:21:14 +02:00
|
|
|
}
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
}
|
|
|
|
|
2002-03-27 18:57:30 +01:00
|
|
|
static GLogFunc
|
|
|
|
g_log_domain_get_handler_L (GLogDomain *domain,
|
|
|
|
GLogLevelFlags log_level,
|
|
|
|
gpointer *data)
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
{
|
|
|
|
if (domain && log_level)
|
1998-06-11 01:21:14 +02:00
|
|
|
{
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
register GLogHandler *handler;
|
|
|
|
|
|
|
|
handler = domain->handlers;
|
|
|
|
while (handler)
|
|
|
|
{
|
|
|
|
if ((handler->log_level & log_level) == log_level)
|
|
|
|
{
|
|
|
|
*data = handler->data;
|
|
|
|
return handler->log_func;
|
|
|
|
}
|
|
|
|
handler = handler->next;
|
|
|
|
}
|
1998-06-11 01:21:14 +02:00
|
|
|
}
|
2004-09-05 07:46:33 +02:00
|
|
|
|
|
|
|
*data = default_log_data;
|
|
|
|
return default_log_func;
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
}
|
|
|
|
|
2011-10-13 04:29:18 +02:00
|
|
|
/**
|
|
|
|
* g_log_set_always_fatal:
|
|
|
|
* @fatal_mask: the mask containing bits set for each level
|
|
|
|
* of error which is to be fatal
|
|
|
|
*
|
|
|
|
* 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
|
2011-12-14 05:00:16 +01:00
|
|
|
* the <envar>G_DEBUG</envar> environment variable (see
|
2011-10-13 04:29:18 +02:00
|
|
|
* <ulink url="glib-running.html">Running GLib Applications</ulink>).
|
|
|
|
*
|
|
|
|
* Returns: the old fatal mask
|
|
|
|
*/
|
1998-08-18 05:50:35 +02:00
|
|
|
GLogLevelFlags
|
|
|
|
g_log_set_always_fatal (GLogLevelFlags fatal_mask)
|
|
|
|
{
|
|
|
|
GLogLevelFlags old_mask;
|
|
|
|
|
2002-03-27 18:57:30 +01:00
|
|
|
/* restrict the global mask to levels that are known to glib
|
|
|
|
* since this setting applies to all domains
|
|
|
|
*/
|
1998-08-18 05:50:35 +02:00
|
|
|
fatal_mask &= (1 << G_LOG_LEVEL_USER_SHIFT) - 1;
|
|
|
|
/* force errors to be fatal */
|
|
|
|
fatal_mask |= G_LOG_LEVEL_ERROR;
|
|
|
|
/* remove bogus flag */
|
|
|
|
fatal_mask &= ~G_LOG_FLAG_FATAL;
|
|
|
|
|
2011-09-17 23:56:33 +02:00
|
|
|
g_mutex_lock (&g_messages_lock);
|
1998-08-18 05:50:35 +02:00
|
|
|
old_mask = g_log_always_fatal;
|
|
|
|
g_log_always_fatal = fatal_mask;
|
2011-09-17 23:56:33 +02:00
|
|
|
g_mutex_unlock (&g_messages_lock);
|
1998-08-18 05:50:35 +02:00
|
|
|
|
|
|
|
return old_mask;
|
|
|
|
}
|
|
|
|
|
2011-10-13 04:29:18 +02:00
|
|
|
/**
|
|
|
|
* g_log_set_fatal_mask:
|
|
|
|
* @log_domain: the log domain
|
|
|
|
* @fatal_mask: the new fatal mask
|
|
|
|
*
|
|
|
|
* Sets the log levels which are fatal in the given domain.
|
|
|
|
* %G_LOG_LEVEL_ERROR is always fatal.
|
|
|
|
*
|
|
|
|
* Returns: the old fatal mask for the log domain
|
|
|
|
*/
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
GLogLevelFlags
|
2002-03-27 18:57:30 +01:00
|
|
|
g_log_set_fatal_mask (const gchar *log_domain,
|
|
|
|
GLogLevelFlags fatal_mask)
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
{
|
|
|
|
GLogLevelFlags old_flags;
|
|
|
|
register GLogDomain *domain;
|
|
|
|
|
|
|
|
if (!log_domain)
|
|
|
|
log_domain = "";
|
|
|
|
|
|
|
|
/* force errors to be fatal */
|
|
|
|
fatal_mask |= G_LOG_LEVEL_ERROR;
|
|
|
|
/* remove bogus flag */
|
|
|
|
fatal_mask &= ~G_LOG_FLAG_FATAL;
|
|
|
|
|
2011-09-17 23:56:33 +02:00
|
|
|
g_mutex_lock (&g_messages_lock);
|
2002-03-14 17:20:42 +01:00
|
|
|
|
2002-03-27 18:57:30 +01:00
|
|
|
domain = g_log_find_domain_L (log_domain);
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
if (!domain)
|
2002-03-27 18:57:30 +01:00
|
|
|
domain = g_log_domain_new_L (log_domain);
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
old_flags = domain->fatal_mask;
|
|
|
|
|
|
|
|
domain->fatal_mask = fatal_mask;
|
2002-03-27 18:57:30 +01:00
|
|
|
g_log_domain_check_free_L (domain);
|
2002-03-14 17:20:42 +01:00
|
|
|
|
2011-09-17 23:56:33 +02:00
|
|
|
g_mutex_unlock (&g_messages_lock);
|
2002-03-14 17:20:42 +01:00
|
|
|
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
return old_flags;
|
|
|
|
}
|
1998-06-11 01:21:14 +02:00
|
|
|
|
2011-10-13 04:29:18 +02:00
|
|
|
/**
|
|
|
|
* g_log_set_handler:
|
2012-03-24 13:58:45 +01:00
|
|
|
* @log_domain: (allow-none): the log domain, or %NULL for the default ""
|
2011-10-13 04:29:18 +02:00
|
|
|
* 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
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* <example>
|
|
|
|
* <title>Adding a log handler for all warning messages in the default
|
|
|
|
* (application) domain</title>
|
|
|
|
* <programlisting>
|
|
|
|
* g_log_set_handler (NULL, G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL
|
|
|
|
* | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
|
|
|
|
* </programlisting>
|
|
|
|
* </example>
|
|
|
|
*
|
|
|
|
* <example>
|
|
|
|
* <title>Adding a log handler for all critical messages from GTK+</title>
|
|
|
|
* <programlisting>
|
|
|
|
* g_log_set_handler ("Gtk", G_LOG_LEVEL_CRITICAL | G_LOG_FLAG_FATAL
|
|
|
|
* | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
|
|
|
|
* </programlisting>
|
|
|
|
* </example>
|
|
|
|
*
|
|
|
|
* <example>
|
|
|
|
* <title>Adding a log handler for <emphasis>all</emphasis> messages from
|
|
|
|
* GLib</title>
|
|
|
|
* <programlisting>
|
|
|
|
* g_log_set_handler ("GLib", G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL
|
|
|
|
* | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
|
|
|
|
* </programlisting>
|
|
|
|
* </example>
|
|
|
|
*
|
|
|
|
* Returns: the id of the new handler
|
|
|
|
*/
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
guint
|
2002-03-27 18:57:30 +01:00
|
|
|
g_log_set_handler (const gchar *log_domain,
|
|
|
|
GLogLevelFlags log_levels,
|
|
|
|
GLogFunc log_func,
|
|
|
|
gpointer user_data)
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
{
|
|
|
|
static guint handler_id = 0;
|
2002-03-27 18:57:30 +01:00
|
|
|
GLogDomain *domain;
|
|
|
|
GLogHandler *handler;
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
|
|
|
|
g_return_val_if_fail ((log_levels & G_LOG_LEVEL_MASK) != 0, 0);
|
|
|
|
g_return_val_if_fail (log_func != NULL, 0);
|
|
|
|
|
|
|
|
if (!log_domain)
|
|
|
|
log_domain = "";
|
2002-03-27 18:57:30 +01:00
|
|
|
|
|
|
|
handler = g_new (GLogHandler, 1);
|
|
|
|
|
2011-09-17 23:56:33 +02:00
|
|
|
g_mutex_lock (&g_messages_lock);
|
2002-03-14 17:20:42 +01:00
|
|
|
|
2002-03-27 18:57:30 +01:00
|
|
|
domain = g_log_find_domain_L (log_domain);
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
if (!domain)
|
2002-03-27 18:57:30 +01:00
|
|
|
domain = g_log_domain_new_L (log_domain);
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
|
|
|
|
handler->id = ++handler_id;
|
|
|
|
handler->log_level = log_levels;
|
|
|
|
handler->log_func = log_func;
|
|
|
|
handler->data = user_data;
|
|
|
|
handler->next = domain->handlers;
|
|
|
|
domain->handlers = handler;
|
2002-03-14 17:20:42 +01:00
|
|
|
|
2011-09-17 23:56:33 +02:00
|
|
|
g_mutex_unlock (&g_messages_lock);
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
|
|
|
|
return handler_id;
|
1998-06-11 01:21:14 +02:00
|
|
|
}
|
|
|
|
|
2011-10-13 04:29:18 +02:00
|
|
|
/**
|
|
|
|
* g_log_set_default_handler:
|
2011-10-19 21:07:22 +02:00
|
|
|
* @log_func: the log handler function
|
2011-10-13 04:29:18 +02:00
|
|
|
* @user_data: data passed to the log handler
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* Returns: the previous default log handler
|
|
|
|
*
|
|
|
|
* Since: 2.6
|
|
|
|
*/
|
2004-09-05 07:46:33 +02:00
|
|
|
GLogFunc
|
|
|
|
g_log_set_default_handler (GLogFunc log_func,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
GLogFunc old_log_func;
|
|
|
|
|
2011-09-17 23:56:33 +02:00
|
|
|
g_mutex_lock (&g_messages_lock);
|
2004-09-05 07:46:33 +02:00
|
|
|
old_log_func = default_log_func;
|
|
|
|
default_log_func = log_func;
|
|
|
|
default_log_data = user_data;
|
2011-09-17 23:56:33 +02:00
|
|
|
g_mutex_unlock (&g_messages_lock);
|
2004-09-05 07:46:33 +02:00
|
|
|
|
|
|
|
return old_log_func;
|
|
|
|
}
|
|
|
|
|
2009-09-10 16:40:11 +02:00
|
|
|
/**
|
|
|
|
* g_test_log_set_fatal_handler:
|
|
|
|
* @log_func: the log handler function.
|
|
|
|
* @user_data: data passed to the log handler.
|
|
|
|
*
|
|
|
|
* Installs a non-error fatal log handler which can be
|
|
|
|
* used to decide whether log messages which are counted
|
|
|
|
* as fatal abort the program.
|
|
|
|
*
|
|
|
|
* The use case here is that you are running a test case
|
|
|
|
* that depends on particular libraries or circumstances
|
|
|
|
* and cannot prevent certain known critical or warning
|
|
|
|
* messages. So you install a handler that compares the
|
|
|
|
* domain and message to precisely not abort in such a case.
|
|
|
|
*
|
|
|
|
* Note that the handler is reset at the beginning of
|
|
|
|
* any test case, so you have to set it inside each test
|
|
|
|
* function which needs the special behavior.
|
|
|
|
*
|
|
|
|
* This handler has no effect on g_error messages.
|
|
|
|
*
|
|
|
|
* Since: 2.22
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
g_test_log_set_fatal_handler (GTestLogFatalFunc log_func,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
2011-09-17 23:56:33 +02:00
|
|
|
g_mutex_lock (&g_messages_lock);
|
2009-09-10 16:40:11 +02:00
|
|
|
fatal_log_func = log_func;
|
|
|
|
fatal_log_data = user_data;
|
2011-09-17 23:56:33 +02:00
|
|
|
g_mutex_unlock (&g_messages_lock);
|
2009-09-10 16:40:11 +02:00
|
|
|
}
|
|
|
|
|
2011-10-13 04:29:18 +02:00
|
|
|
/**
|
|
|
|
* g_log_remove_handler:
|
|
|
|
* @log_domain: the log domain
|
|
|
|
* @handler_id: the id of the handler, which was returned
|
|
|
|
* in g_log_set_handler()
|
|
|
|
*
|
|
|
|
* Removes the log handler.
|
|
|
|
*/
|
1998-06-11 01:21:14 +02:00
|
|
|
void
|
1999-10-12 14:08:13 +02:00
|
|
|
g_log_remove_handler (const gchar *log_domain,
|
|
|
|
guint handler_id)
|
1998-06-11 01:21:14 +02:00
|
|
|
{
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
register GLogDomain *domain;
|
|
|
|
|
|
|
|
g_return_if_fail (handler_id > 0);
|
|
|
|
|
|
|
|
if (!log_domain)
|
|
|
|
log_domain = "";
|
|
|
|
|
2011-09-17 23:56:33 +02:00
|
|
|
g_mutex_lock (&g_messages_lock);
|
2002-03-27 18:57:30 +01:00
|
|
|
domain = g_log_find_domain_L (log_domain);
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
if (domain)
|
|
|
|
{
|
2002-03-27 18:57:30 +01:00
|
|
|
GLogHandler *work, *last;
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
|
|
|
|
last = NULL;
|
|
|
|
work = domain->handlers;
|
|
|
|
while (work)
|
|
|
|
{
|
|
|
|
if (work->id == handler_id)
|
|
|
|
{
|
|
|
|
if (last)
|
|
|
|
last->next = work->next;
|
|
|
|
else
|
|
|
|
domain->handlers = work->next;
|
2002-03-27 18:57:30 +01:00
|
|
|
g_log_domain_check_free_L (domain);
|
2011-09-17 23:56:33 +02:00
|
|
|
g_mutex_unlock (&g_messages_lock);
|
2002-03-27 18:57:30 +01:00
|
|
|
g_free (work);
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
return;
|
|
|
|
}
|
2000-08-06 20:09:32 +02:00
|
|
|
last = work;
|
|
|
|
work = last->next;
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
}
|
2002-03-14 17:20:42 +01:00
|
|
|
}
|
2011-09-17 23:56:33 +02:00
|
|
|
g_mutex_unlock (&g_messages_lock);
|
2013-05-20 22:54:48 +02:00
|
|
|
g_warning ("%s: could not find handler with id '%d' for domain \"%s\"",
|
2002-03-27 18:57:30 +01:00
|
|
|
G_STRLOC, handler_id, log_domain);
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
}
|
1998-06-11 01:21:14 +02:00
|
|
|
|
2012-07-30 22:05:08 +02:00
|
|
|
#define CHAR_IS_SAFE(wc) (!((wc < 0x20 && wc != '\t' && wc != '\n' && wc != '\r') || \
|
|
|
|
(wc == 0x7f) || \
|
|
|
|
(wc >= 0x80 && wc < 0xa0)))
|
|
|
|
|
|
|
|
static gchar*
|
|
|
|
strdup_convert (const gchar *string,
|
|
|
|
const gchar *charset)
|
|
|
|
{
|
|
|
|
if (!g_utf8_validate (string, -1, NULL))
|
|
|
|
{
|
|
|
|
GString *gstring = g_string_new ("[Invalid UTF-8] ");
|
|
|
|
guchar *p;
|
|
|
|
|
|
|
|
for (p = (guchar *)string; *p; p++)
|
|
|
|
{
|
|
|
|
if (CHAR_IS_SAFE(*p) &&
|
|
|
|
!(*p == '\r' && *(p + 1) != '\n') &&
|
|
|
|
*p < 0x80)
|
|
|
|
g_string_append_c (gstring, *p);
|
|
|
|
else
|
|
|
|
g_string_append_printf (gstring, "\\x%02x", (guint)(guchar)*p);
|
|
|
|
}
|
|
|
|
|
|
|
|
return g_string_free (gstring, FALSE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GError *err = NULL;
|
|
|
|
|
|
|
|
gchar *result = g_convert_with_fallback (string, -1, charset, "UTF-8", "?", NULL, NULL, &err);
|
|
|
|
if (result)
|
|
|
|
return result;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Not thread-safe, but doesn't matter if we print the warning twice
|
|
|
|
*/
|
|
|
|
static gboolean warned = FALSE;
|
|
|
|
if (!warned)
|
|
|
|
{
|
|
|
|
warned = TRUE;
|
|
|
|
_g_fprintf (stderr, "GLib: Cannot convert message: %s\n", err->message);
|
|
|
|
}
|
|
|
|
g_error_free (err);
|
|
|
|
|
|
|
|
return g_strdup (string);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* For a radix of 8 we need at most 3 output bytes for 1 input
|
|
|
|
* byte. Additionally we might need up to 2 output bytes for the
|
|
|
|
* readix prefix and 1 byte for the trailing NULL.
|
|
|
|
*/
|
|
|
|
#define FORMAT_UNSIGNED_BUFSIZE ((GLIB_SIZEOF_LONG * 3) + 3)
|
|
|
|
|
|
|
|
static void
|
|
|
|
format_unsigned (gchar *buf,
|
|
|
|
gulong num,
|
|
|
|
guint radix)
|
|
|
|
{
|
|
|
|
gulong tmp;
|
|
|
|
gchar c;
|
|
|
|
gint i, n;
|
|
|
|
|
|
|
|
/* we may not call _any_ GLib functions here (or macros like g_return_if_fail()) */
|
|
|
|
|
|
|
|
if (radix != 8 && radix != 10 && radix != 16)
|
|
|
|
{
|
|
|
|
*buf = '\000';
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!num)
|
|
|
|
{
|
|
|
|
*buf++ = '0';
|
|
|
|
*buf = '\000';
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (radix == 16)
|
|
|
|
{
|
|
|
|
*buf++ = '0';
|
|
|
|
*buf++ = 'x';
|
|
|
|
}
|
|
|
|
else if (radix == 8)
|
|
|
|
{
|
|
|
|
*buf++ = '0';
|
|
|
|
}
|
|
|
|
|
|
|
|
n = 0;
|
|
|
|
tmp = num;
|
|
|
|
while (tmp)
|
|
|
|
{
|
|
|
|
tmp /= radix;
|
|
|
|
n++;
|
|
|
|
}
|
|
|
|
|
|
|
|
i = n;
|
|
|
|
|
|
|
|
/* Again we can't use g_assert; actually this check should _never_ fail. */
|
|
|
|
if (n > FORMAT_UNSIGNED_BUFSIZE - 3)
|
|
|
|
{
|
|
|
|
*buf = '\000';
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (num)
|
|
|
|
{
|
|
|
|
i--;
|
|
|
|
c = (num % radix);
|
|
|
|
if (c < 10)
|
|
|
|
buf[i] = c + '0';
|
|
|
|
else
|
|
|
|
buf[i] = c + 'a' - 10;
|
|
|
|
num /= radix;
|
|
|
|
}
|
|
|
|
|
|
|
|
buf[n] = '\000';
|
|
|
|
}
|
|
|
|
|
|
|
|
/* string size big enough to hold level prefix */
|
|
|
|
#define STRING_BUFFER_SIZE (FORMAT_UNSIGNED_BUFSIZE + 32)
|
|
|
|
|
|
|
|
#define ALERT_LEVELS (G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING)
|
|
|
|
|
|
|
|
/* these are emitted by the default log handler */
|
|
|
|
#define DEFAULT_LEVELS (G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE)
|
|
|
|
/* these are filtered by G_MESSAGES_DEBUG by the default log handler */
|
|
|
|
#define INFO_LEVELS (G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG)
|
|
|
|
|
|
|
|
static int
|
|
|
|
mklevel_prefix (gchar level_prefix[STRING_BUFFER_SIZE],
|
|
|
|
GLogLevelFlags log_level)
|
|
|
|
{
|
|
|
|
gboolean to_stdout = TRUE;
|
|
|
|
|
|
|
|
/* we may not call _any_ GLib functions here */
|
|
|
|
|
|
|
|
switch (log_level & G_LOG_LEVEL_MASK)
|
|
|
|
{
|
|
|
|
case G_LOG_LEVEL_ERROR:
|
|
|
|
strcpy (level_prefix, "ERROR");
|
|
|
|
to_stdout = FALSE;
|
|
|
|
break;
|
|
|
|
case G_LOG_LEVEL_CRITICAL:
|
|
|
|
strcpy (level_prefix, "CRITICAL");
|
|
|
|
to_stdout = FALSE;
|
|
|
|
break;
|
|
|
|
case G_LOG_LEVEL_WARNING:
|
|
|
|
strcpy (level_prefix, "WARNING");
|
|
|
|
to_stdout = FALSE;
|
|
|
|
break;
|
|
|
|
case G_LOG_LEVEL_MESSAGE:
|
|
|
|
strcpy (level_prefix, "Message");
|
|
|
|
to_stdout = FALSE;
|
|
|
|
break;
|
|
|
|
case G_LOG_LEVEL_INFO:
|
|
|
|
strcpy (level_prefix, "INFO");
|
|
|
|
break;
|
|
|
|
case G_LOG_LEVEL_DEBUG:
|
|
|
|
strcpy (level_prefix, "DEBUG");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (log_level)
|
|
|
|
{
|
|
|
|
strcpy (level_prefix, "LOG-");
|
|
|
|
format_unsigned (level_prefix + 4, log_level & G_LOG_LEVEL_MASK, 16);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
strcpy (level_prefix, "LOG");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (log_level & G_LOG_FLAG_RECURSION)
|
|
|
|
strcat (level_prefix, " (recursed)");
|
|
|
|
if (log_level & ALERT_LEVELS)
|
|
|
|
strcat (level_prefix, " **");
|
|
|
|
|
|
|
|
#ifdef G_OS_WIN32
|
2012-11-16 04:26:54 +01:00
|
|
|
if ((log_level & G_LOG_FLAG_FATAL) != 0 && !g_test_initialized ())
|
|
|
|
win32_keep_fatal_message = TRUE;
|
2012-07-30 22:05:08 +02:00
|
|
|
#endif
|
|
|
|
return to_stdout ? 1 : 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
gchar *log_domain;
|
|
|
|
GLogLevelFlags log_level;
|
|
|
|
gchar *pattern;
|
|
|
|
} GTestExpectedMessage;
|
|
|
|
|
|
|
|
static GSList *expected_messages = NULL;
|
|
|
|
|
2011-10-13 04:29:18 +02:00
|
|
|
/**
|
|
|
|
* g_logv:
|
|
|
|
* @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
|
|
|
|
*
|
|
|
|
* Logs an error or debugging message.
|
|
|
|
*
|
|
|
|
* If the log level has been set as fatal, the abort()
|
|
|
|
* function is called to terminate the program.
|
2013-10-21 16:09:13 +02:00
|
|
|
*
|
|
|
|
* If g_log_default_handler() is used as the log handler function, a new-line
|
|
|
|
* character will automatically be appended to @..., and need not be entered
|
|
|
|
* manually.
|
2011-10-13 04:29:18 +02:00
|
|
|
*/
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
void
|
1999-10-12 14:08:13 +02:00
|
|
|
g_logv (const gchar *log_domain,
|
|
|
|
GLogLevelFlags log_level,
|
|
|
|
const gchar *format,
|
2012-07-30 21:32:31 +02:00
|
|
|
va_list args)
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
{
|
2002-03-27 18:57:30 +01:00
|
|
|
gboolean was_fatal = (log_level & G_LOG_FLAG_FATAL) != 0;
|
|
|
|
gboolean was_recursion = (log_level & G_LOG_FLAG_RECURSION) != 0;
|
2012-07-30 21:32:31 +02:00
|
|
|
gchar buffer[1025], *msg, *msg_alloc = NULL;
|
2002-03-27 18:57:30 +01:00
|
|
|
gint i;
|
2001-10-29 19:49:28 +01:00
|
|
|
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
log_level &= G_LOG_LEVEL_MASK;
|
|
|
|
if (!log_level)
|
|
|
|
return;
|
2009-09-30 02:45:26 +02:00
|
|
|
|
2012-07-30 21:32:31 +02:00
|
|
|
if (log_level & G_LOG_FLAG_RECURSION)
|
|
|
|
{
|
|
|
|
/* we use a stack buffer of fixed size, since we're likely
|
|
|
|
* in an out-of-memory situation
|
|
|
|
*/
|
|
|
|
gsize size G_GNUC_UNUSED;
|
|
|
|
|
|
|
|
size = _g_vsnprintf (buffer, 1024, format, args);
|
|
|
|
msg = buffer;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
msg = msg_alloc = g_strdup_vprintf (format, args);
|
|
|
|
|
2012-07-30 22:05:08 +02:00
|
|
|
if (expected_messages)
|
|
|
|
{
|
|
|
|
GTestExpectedMessage *expected = expected_messages->data;
|
|
|
|
|
2013-08-31 17:51:07 +02:00
|
|
|
if (g_strcmp0 (expected->log_domain, log_domain) == 0 &&
|
2012-07-30 22:05:08 +02:00
|
|
|
((log_level & expected->log_level) == expected->log_level) &&
|
|
|
|
g_pattern_match_simple (expected->pattern, msg))
|
|
|
|
{
|
2013-10-28 10:12:29 +01:00
|
|
|
expected_messages = g_slist_delete_link (expected_messages,
|
|
|
|
expected_messages);
|
2012-07-30 22:05:08 +02:00
|
|
|
g_free (expected->log_domain);
|
|
|
|
g_free (expected->pattern);
|
|
|
|
g_free (expected);
|
|
|
|
g_free (msg_alloc);
|
|
|
|
return;
|
|
|
|
}
|
2013-10-28 10:12:29 +01:00
|
|
|
else if ((log_level & G_LOG_LEVEL_DEBUG) != G_LOG_LEVEL_DEBUG)
|
2012-07-30 22:05:08 +02:00
|
|
|
{
|
|
|
|
gchar level_prefix[STRING_BUFFER_SIZE];
|
|
|
|
gchar *expected_message;
|
|
|
|
|
|
|
|
mklevel_prefix (level_prefix, expected->log_level);
|
|
|
|
expected_message = g_strdup_printf ("Did not see expected message %s: %s",
|
|
|
|
level_prefix, expected->pattern);
|
|
|
|
g_log_default_handler (log_domain, log_level, expected_message, NULL);
|
|
|
|
g_free (expected_message);
|
|
|
|
|
|
|
|
log_level |= G_LOG_FLAG_FATAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
for (i = g_bit_nth_msf (log_level, -1); i >= 0; i = g_bit_nth_msf (log_level, i))
|
1998-06-11 01:21:14 +02:00
|
|
|
{
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
register GLogLevelFlags test_level;
|
2009-09-30 02:45:26 +02:00
|
|
|
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
test_level = 1 << i;
|
|
|
|
if (log_level & test_level)
|
|
|
|
{
|
|
|
|
GLogDomain *domain;
|
|
|
|
GLogFunc log_func;
|
2004-09-20 05:53:39 +02:00
|
|
|
GLogLevelFlags domain_fatal_mask;
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
gpointer data = NULL;
|
2009-09-30 02:45:26 +02:00
|
|
|
gboolean masquerade_fatal = FALSE;
|
2011-09-18 07:21:01 +02:00
|
|
|
guint depth;
|
2002-03-14 17:20:42 +01:00
|
|
|
|
2002-03-27 18:57:30 +01:00
|
|
|
if (was_fatal)
|
|
|
|
test_level |= G_LOG_FLAG_FATAL;
|
|
|
|
if (was_recursion)
|
|
|
|
test_level |= G_LOG_FLAG_RECURSION;
|
|
|
|
|
|
|
|
/* check recursion and lookup handler */
|
2011-09-17 23:56:33 +02:00
|
|
|
g_mutex_lock (&g_messages_lock);
|
2011-09-18 07:21:01 +02:00
|
|
|
depth = GPOINTER_TO_UINT (g_private_get (&g_log_depth));
|
2002-03-27 18:57:30 +01:00
|
|
|
domain = g_log_find_domain_L (log_domain ? log_domain : "");
|
1998-12-15 06:28:02 +01:00
|
|
|
if (depth)
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
test_level |= G_LOG_FLAG_RECURSION;
|
1998-12-15 06:28:02 +01:00
|
|
|
depth++;
|
2002-03-27 18:57:30 +01:00
|
|
|
domain_fatal_mask = domain ? domain->fatal_mask : G_LOG_FATAL_MASK;
|
|
|
|
if ((domain_fatal_mask | g_log_always_fatal) & test_level)
|
|
|
|
test_level |= G_LOG_FLAG_FATAL;
|
|
|
|
if (test_level & G_LOG_FLAG_RECURSION)
|
|
|
|
log_func = _g_log_fallback_handler;
|
|
|
|
else
|
|
|
|
log_func = g_log_domain_get_handler_L (domain, test_level, &data);
|
|
|
|
domain = NULL;
|
2011-09-17 23:56:33 +02:00
|
|
|
g_mutex_unlock (&g_messages_lock);
|
2002-03-27 18:57:30 +01:00
|
|
|
|
2011-09-18 07:10:07 +02:00
|
|
|
g_private_set (&g_log_depth, GUINT_TO_POINTER (depth));
|
1998-12-15 06:28:02 +01:00
|
|
|
|
2012-07-30 21:32:31 +02:00
|
|
|
log_func (log_domain, test_level, msg, data);
|
2002-03-14 17:20:42 +01:00
|
|
|
|
2012-07-30 21:32:31 +02:00
|
|
|
if ((test_level & G_LOG_FLAG_FATAL)
|
|
|
|
&& !(test_level & G_LOG_LEVEL_ERROR))
|
|
|
|
{
|
|
|
|
masquerade_fatal = fatal_log_func
|
|
|
|
&& !fatal_log_func (log_domain, test_level, msg, fatal_log_data);
|
|
|
|
}
|
2002-03-27 18:57:30 +01:00
|
|
|
|
2013-05-21 01:07:18 +02:00
|
|
|
if ((test_level & G_LOG_FLAG_FATAL) && exit_on_fatal && !masquerade_fatal)
|
2013-05-20 15:31:48 +02:00
|
|
|
{
|
|
|
|
_g_log_abort ();
|
|
|
|
}
|
|
|
|
else if ((test_level & G_LOG_FLAG_FATAL) && !masquerade_fatal)
|
2009-09-10 16:40:11 +02:00
|
|
|
{
|
2002-02-14 08:06:56 +01:00
|
|
|
#ifdef G_OS_WIN32
|
2012-11-16 04:26:54 +01:00
|
|
|
if (win32_keep_fatal_message)
|
|
|
|
{
|
|
|
|
gchar *locale_msg = g_locale_from_utf8 (fatal_msg_buf, -1, NULL, NULL, NULL);
|
|
|
|
|
|
|
|
MessageBox (NULL, locale_msg, NULL,
|
|
|
|
MB_ICONERROR|MB_SETFOREGROUND);
|
|
|
|
}
|
2005-01-19 02:55:40 +01:00
|
|
|
if (IsDebuggerPresent () && !(test_level & G_LOG_FLAG_RECURSION))
|
2005-01-19 03:27:37 +01:00
|
|
|
G_BREAKPOINT ();
|
2006-12-28 15:47:54 +01:00
|
|
|
else
|
|
|
|
abort ();
|
2005-01-19 02:55:40 +01:00
|
|
|
#else
|
1999-09-14 00:17:27 +02:00
|
|
|
if (!(test_level & G_LOG_FLAG_RECURSION))
|
2001-06-23 22:14:48 +02:00
|
|
|
G_BREAKPOINT ();
|
1999-09-14 00:17:27 +02:00
|
|
|
else
|
|
|
|
abort ();
|
2005-01-19 02:55:40 +01:00
|
|
|
#endif /* !G_OS_WIN32 */
|
1999-09-14 00:17:27 +02:00
|
|
|
}
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
|
1998-12-15 06:28:02 +01:00
|
|
|
depth--;
|
2011-09-18 07:10:07 +02:00
|
|
|
g_private_set (&g_log_depth, GUINT_TO_POINTER (depth));
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
}
|
1998-06-11 01:21:14 +02:00
|
|
|
}
|
2012-07-30 21:32:31 +02:00
|
|
|
|
|
|
|
g_free (msg_alloc);
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
}
|
|
|
|
|
2011-10-13 04:29:18 +02:00
|
|
|
/**
|
|
|
|
* g_log:
|
|
|
|
* @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
|
|
|
|
*
|
|
|
|
* Logs an error or debugging message.
|
|
|
|
*
|
|
|
|
* If the log level has been set as fatal, the abort()
|
|
|
|
* function is called to terminate the program.
|
2013-10-21 16:09:13 +02:00
|
|
|
*
|
|
|
|
* If g_log_default_handler() is used as the log handler function, a new-line
|
|
|
|
* character will automatically be appended to @..., and need not be entered
|
|
|
|
* manually.
|
2011-10-13 04:29:18 +02:00
|
|
|
*/
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
void
|
2002-03-27 18:57:30 +01:00
|
|
|
g_log (const gchar *log_domain,
|
|
|
|
GLogLevelFlags log_level,
|
|
|
|
const gchar *format,
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
...)
|
|
|
|
{
|
removed this function which was not publically exported in glib.h. to
Mon Aug 24 02:08:56 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gstring.c:
* gstrfuncs.c:
(g_vsprintf): removed this function which was not publically
exported in glib.h. to export it, it should have been named
differently in the first place, since its semantics differ from
vsprintf(). apart from that, it was a possible cause for
problems since it worked on a previously allocated memory area and
was used in a lot places of glib. exporting it would have been a
guararant for problems with threaded programs.
(g_printf_string_upper_bound): exported this function to return
a string size, guarranteed to be big enough to hold the fully
expanded format+args string. added 'q', 'L' and 'll' flag handling.
in fact, the newly allocated area is in most cases much bigger than
required.
(g_strdup_vprintf()): new function returning a newly allocated string
containing the contents of *format and associated args (size is
calculated with g_printf_string_upper_bound()).
(g_strdup_printf): new function which wraps g_strdup_vprintf().
* configure.in: check for va_copy() or __va_copy() alternatively.
check whether va_lists can be copyied by value.
* glib.h: provide a definition for G_VA_COPY.
* glib.h:
* gmessages.c:
(g_logv):
(g_vsnprintf):
pass va_lists by value, not by reference, since this causes problems
on platforms that implement va_list as as arrays. internaly, use
G_VA_COPY (new_arg, org_arg); va_end (new_arg); to produce a second
va_list variable, if multiple passes are required. changed all
callers.
* glib.h:
* gerror.h:
renamed g_debug() to g_on_error_query(), cleaned up a bit.
renamed g_stack_trace() to g_on_error_stack_trace() since both
functions cluttered different namespaces.
there is an appropriate comment in glib.h now that explains the
unix and gdb specific dependencies of both functions.
removed g_attach_process().
g_on_error_stack_trace() should probably be handled with caution,
i've seem several different linux versions (2.0.x) become unstable
after invokation of this function.
1998-08-24 07:26:53 +02:00
|
|
|
va_list args;
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
|
removed this function which was not publically exported in glib.h. to
Mon Aug 24 02:08:56 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gstring.c:
* gstrfuncs.c:
(g_vsprintf): removed this function which was not publically
exported in glib.h. to export it, it should have been named
differently in the first place, since its semantics differ from
vsprintf(). apart from that, it was a possible cause for
problems since it worked on a previously allocated memory area and
was used in a lot places of glib. exporting it would have been a
guararant for problems with threaded programs.
(g_printf_string_upper_bound): exported this function to return
a string size, guarranteed to be big enough to hold the fully
expanded format+args string. added 'q', 'L' and 'll' flag handling.
in fact, the newly allocated area is in most cases much bigger than
required.
(g_strdup_vprintf()): new function returning a newly allocated string
containing the contents of *format and associated args (size is
calculated with g_printf_string_upper_bound()).
(g_strdup_printf): new function which wraps g_strdup_vprintf().
* configure.in: check for va_copy() or __va_copy() alternatively.
check whether va_lists can be copyied by value.
* glib.h: provide a definition for G_VA_COPY.
* glib.h:
* gmessages.c:
(g_logv):
(g_vsnprintf):
pass va_lists by value, not by reference, since this causes problems
on platforms that implement va_list as as arrays. internaly, use
G_VA_COPY (new_arg, org_arg); va_end (new_arg); to produce a second
va_list variable, if multiple passes are required. changed all
callers.
* glib.h:
* gerror.h:
renamed g_debug() to g_on_error_query(), cleaned up a bit.
renamed g_stack_trace() to g_on_error_stack_trace() since both
functions cluttered different namespaces.
there is an appropriate comment in glib.h now that explains the
unix and gdb specific dependencies of both functions.
removed g_attach_process().
g_on_error_stack_trace() should probably be handled with caution,
i've seem several different linux versions (2.0.x) become unstable
after invokation of this function.
1998-08-24 07:26:53 +02:00
|
|
|
va_start (args, format);
|
|
|
|
g_logv (log_domain, log_level, format, args);
|
|
|
|
va_end (args);
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
}
|
|
|
|
|
2004-09-09 19:55:05 +02:00
|
|
|
void
|
|
|
|
g_return_if_fail_warning (const char *log_domain,
|
|
|
|
const char *pretty_function,
|
|
|
|
const char *expression)
|
|
|
|
{
|
|
|
|
g_log (log_domain,
|
|
|
|
G_LOG_LEVEL_CRITICAL,
|
2013-05-20 22:54:48 +02:00
|
|
|
"%s: assertion '%s' failed",
|
2004-09-09 19:55:05 +02:00
|
|
|
pretty_function,
|
2004-09-30 04:02:00 +02:00
|
|
|
expression);
|
|
|
|
}
|
|
|
|
|
2007-12-10 15:07:42 +01:00
|
|
|
void
|
|
|
|
g_warn_message (const char *domain,
|
|
|
|
const char *file,
|
|
|
|
int line,
|
|
|
|
const char *func,
|
|
|
|
const char *warnexpr)
|
|
|
|
{
|
|
|
|
char *s, lstr[32];
|
|
|
|
g_snprintf (lstr, 32, "%d", line);
|
|
|
|
if (warnexpr)
|
|
|
|
s = g_strconcat ("(", file, ":", lstr, "):",
|
|
|
|
func, func[0] ? ":" : "",
|
|
|
|
" runtime check failed: (", warnexpr, ")", NULL);
|
|
|
|
else
|
|
|
|
s = g_strconcat ("(", file, ":", lstr, "):",
|
|
|
|
func, func[0] ? ":" : "",
|
|
|
|
" ", "code should not be reached", NULL);
|
|
|
|
g_log (domain, G_LOG_LEVEL_WARNING, "%s", s);
|
|
|
|
g_free (s);
|
|
|
|
}
|
|
|
|
|
2004-09-30 04:02:00 +02:00
|
|
|
void
|
|
|
|
g_assert_warning (const char *log_domain,
|
|
|
|
const char *file,
|
|
|
|
const int line,
|
|
|
|
const char *pretty_function,
|
|
|
|
const char *expression)
|
|
|
|
{
|
|
|
|
g_log (log_domain,
|
|
|
|
G_LOG_LEVEL_ERROR,
|
|
|
|
expression
|
|
|
|
? "file %s: line %d (%s): assertion failed: (%s)"
|
|
|
|
: "file %s: line %d (%s): should not be reached",
|
|
|
|
file,
|
|
|
|
line,
|
|
|
|
pretty_function,
|
2004-09-09 19:55:05 +02:00
|
|
|
expression);
|
2013-05-20 15:31:48 +02:00
|
|
|
_g_log_abort ();
|
2004-09-09 19:55:05 +02:00
|
|
|
}
|
|
|
|
|
2012-07-30 22:05:08 +02:00
|
|
|
/**
|
|
|
|
* g_test_expect_message:
|
2013-08-31 17:51:07 +02:00
|
|
|
* @log_domain: (allow-none): the log domain of the message
|
2012-07-30 22:05:08 +02:00
|
|
|
* @log_level: the log level of the message
|
|
|
|
* @pattern: a glob-style
|
|
|
|
* <link linkend="glib-Glob-style-pattern-matching">pattern</link>
|
|
|
|
*
|
|
|
|
* Indicates that a message with the given @log_domain and @log_level,
|
|
|
|
* with text matching @pattern, is expected to be logged. When this
|
|
|
|
* message is logged, it will not be printed, and the test case will
|
|
|
|
* not abort.
|
|
|
|
*
|
|
|
|
* Use g_test_assert_expected_messages() to assert that all
|
|
|
|
* previously-expected messages have been seen and suppressed.
|
|
|
|
*
|
|
|
|
* You can call this multiple times in a row, if multiple messages are
|
|
|
|
* expected as a result of a single call. (The messages must appear in
|
|
|
|
* the same order as the calls to g_test_expect_message().)
|
|
|
|
*
|
|
|
|
* For example:
|
|
|
|
*
|
|
|
|
* |[
|
|
|
|
* /* g_main_context_push_thread_default() should fail if the
|
|
|
|
* * context is already owned by another thread.
|
|
|
|
* */
|
|
|
|
* g_test_expect_message (G_LOG_DOMAIN,
|
2012-10-30 13:15:23 +01:00
|
|
|
* G_LOG_LEVEL_CRITICAL,
|
2012-11-24 21:47:45 +01:00
|
|
|
* "assertion*acquired_context*failed");
|
2012-07-30 22:05:08 +02:00
|
|
|
* g_main_context_push_thread_default (bad_context);
|
|
|
|
* g_test_assert_expected_messages ();
|
|
|
|
* ]|
|
|
|
|
*
|
|
|
|
* Note that you cannot use this to test g_error() messages, since
|
|
|
|
* g_error() intentionally never returns even if the program doesn't
|
2012-11-24 21:58:27 +01:00
|
|
|
* abort; use g_test_trap_subprocess() in this case.
|
2012-07-30 22:05:08 +02:00
|
|
|
*
|
2013-10-28 10:12:29 +01:00
|
|
|
* If messages at %G_LOG_LEVEL_DEBUG are emitted, but not explicitly
|
|
|
|
* expected via g_test_expect_message() then they will be ignored.
|
|
|
|
*
|
2012-07-30 22:05:08 +02:00
|
|
|
* Since: 2.34
|
2002-03-27 18:57:30 +01:00
|
|
|
*/
|
2012-07-30 22:05:08 +02:00
|
|
|
void
|
|
|
|
g_test_expect_message (const gchar *log_domain,
|
|
|
|
GLogLevelFlags log_level,
|
|
|
|
const gchar *pattern)
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
{
|
2012-07-30 22:05:08 +02:00
|
|
|
GTestExpectedMessage *expected;
|
2002-03-27 18:57:30 +01:00
|
|
|
|
2012-08-20 22:25:09 +02:00
|
|
|
g_return_if_fail (log_level != 0);
|
|
|
|
g_return_if_fail (pattern != NULL);
|
2013-10-19 02:40:57 +02:00
|
|
|
g_return_if_fail (~log_level & G_LOG_LEVEL_ERROR);
|
2012-08-20 22:25:09 +02:00
|
|
|
|
2012-07-30 22:05:08 +02:00
|
|
|
expected = g_new (GTestExpectedMessage, 1);
|
|
|
|
expected->log_domain = g_strdup (log_domain);
|
|
|
|
expected->log_level = log_level;
|
|
|
|
expected->pattern = g_strdup (pattern);
|
2002-03-27 18:57:30 +01:00
|
|
|
|
2012-07-30 22:05:08 +02:00
|
|
|
expected_messages = g_slist_append (expected_messages, expected);
|
2002-03-27 18:57:30 +01:00
|
|
|
}
|
|
|
|
|
2012-07-30 22:05:08 +02:00
|
|
|
void
|
|
|
|
g_test_assert_expected_messages_internal (const char *domain,
|
|
|
|
const char *file,
|
|
|
|
int line,
|
|
|
|
const char *func)
|
2002-03-27 18:57:30 +01:00
|
|
|
{
|
2012-07-30 22:05:08 +02:00
|
|
|
if (expected_messages)
|
|
|
|
{
|
|
|
|
GTestExpectedMessage *expected;
|
|
|
|
gchar level_prefix[STRING_BUFFER_SIZE];
|
|
|
|
gchar *message;
|
2002-03-27 18:57:30 +01:00
|
|
|
|
2012-07-30 22:05:08 +02:00
|
|
|
expected = expected_messages->data;
|
2002-03-27 18:57:30 +01:00
|
|
|
|
2012-07-30 22:05:08 +02:00
|
|
|
mklevel_prefix (level_prefix, expected->log_level);
|
|
|
|
message = g_strdup_printf ("Did not see expected message %s: %s",
|
|
|
|
level_prefix, expected->pattern);
|
|
|
|
g_assertion_message (domain, file, line, func, message);
|
|
|
|
g_free (message);
|
2002-03-27 18:57:30 +01:00
|
|
|
}
|
|
|
|
}
|
2001-05-09 18:36:17 +02:00
|
|
|
|
2012-07-30 22:05:08 +02:00
|
|
|
/**
|
|
|
|
* g_test_assert_expected_messages:
|
|
|
|
*
|
|
|
|
* Asserts that all messages previously indicated via
|
|
|
|
* g_test_expect_message() have been seen and suppressed.
|
|
|
|
*
|
2013-10-28 10:12:29 +01:00
|
|
|
* If messages at %G_LOG_LEVEL_DEBUG are emitted, but not explicitly
|
|
|
|
* expected via g_test_expect_message() then they will be ignored.
|
|
|
|
*
|
2012-07-30 22:05:08 +02:00
|
|
|
* Since: 2.34
|
|
|
|
*/
|
|
|
|
|
2002-03-27 18:57:30 +01:00
|
|
|
void
|
|
|
|
_g_log_fallback_handler (const gchar *log_domain,
|
|
|
|
GLogLevelFlags log_level,
|
|
|
|
const gchar *message,
|
|
|
|
gpointer unused_data)
|
|
|
|
{
|
2004-09-22 23:15:35 +02:00
|
|
|
gchar level_prefix[STRING_BUFFER_SIZE];
|
|
|
|
#ifndef G_OS_WIN32
|
|
|
|
gchar pid_string[FORMAT_UNSIGNED_BUFSIZE];
|
|
|
|
#endif
|
|
|
|
int fd;
|
2002-03-27 18:57:30 +01:00
|
|
|
|
2011-03-24 09:33:55 +01:00
|
|
|
/* we cannot call _any_ GLib functions in this fallback handler,
|
2002-03-27 18:57:30 +01:00
|
|
|
* which is why we skip UTF-8 conversion, etc.
|
|
|
|
* since we either recursed or ran out of memory, we're in a pretty
|
|
|
|
* pathologic situation anyways, what we can do is giving the
|
|
|
|
* the process ID unconditionally however.
|
|
|
|
*/
|
|
|
|
|
|
|
|
fd = mklevel_prefix (level_prefix, log_level);
|
|
|
|
if (!message)
|
|
|
|
message = "(NULL) message";
|
|
|
|
|
2004-09-22 23:15:35 +02:00
|
|
|
#ifndef G_OS_WIN32
|
2002-03-27 18:57:30 +01:00
|
|
|
format_unsigned (pid_string, getpid (), 10);
|
2004-09-22 23:15:35 +02:00
|
|
|
#endif
|
2002-03-27 18:57:30 +01:00
|
|
|
|
|
|
|
if (log_domain)
|
|
|
|
write_string (fd, "\n");
|
|
|
|
else
|
|
|
|
write_string (fd, "\n** ");
|
2004-09-22 23:15:35 +02:00
|
|
|
|
|
|
|
#ifndef G_OS_WIN32
|
2002-03-27 18:57:30 +01:00
|
|
|
write_string (fd, "(process:");
|
|
|
|
write_string (fd, pid_string);
|
|
|
|
write_string (fd, "): ");
|
2004-09-22 23:15:35 +02:00
|
|
|
#endif
|
|
|
|
|
2002-03-27 18:57:30 +01:00
|
|
|
if (log_domain)
|
|
|
|
{
|
|
|
|
write_string (fd, log_domain);
|
|
|
|
write_string (fd, "-");
|
|
|
|
}
|
|
|
|
write_string (fd, level_prefix);
|
|
|
|
write_string (fd, ": ");
|
|
|
|
write_string (fd, message);
|
|
|
|
}
|
|
|
|
|
2003-08-25 18:36:03 +02:00
|
|
|
static void
|
|
|
|
escape_string (GString *string)
|
|
|
|
{
|
|
|
|
const char *p = string->str;
|
|
|
|
gunichar wc;
|
|
|
|
|
|
|
|
while (p < string->str + string->len)
|
|
|
|
{
|
|
|
|
gboolean safe;
|
|
|
|
|
2004-03-14 19:59:33 +01:00
|
|
|
wc = g_utf8_get_char_validated (p, -1);
|
|
|
|
if (wc == (gunichar)-1 || wc == (gunichar)-2)
|
|
|
|
{
|
|
|
|
gchar *tmp;
|
2004-04-22 22:17:54 +02:00
|
|
|
guint pos;
|
|
|
|
|
|
|
|
pos = p - string->str;
|
|
|
|
|
2004-03-14 19:59:33 +01:00
|
|
|
/* Emit invalid UTF-8 as hex escapes
|
|
|
|
*/
|
|
|
|
tmp = g_strdup_printf ("\\x%02x", (guint)(guchar)*p);
|
2004-04-22 22:17:54 +02:00
|
|
|
g_string_erase (string, pos, 1);
|
|
|
|
g_string_insert (string, pos, tmp);
|
2004-03-14 19:59:33 +01:00
|
|
|
|
2004-04-22 22:17:54 +02:00
|
|
|
p = string->str + (pos + 4); /* Skip over escape sequence */
|
2004-03-14 19:59:33 +01:00
|
|
|
|
2004-04-22 22:17:54 +02:00
|
|
|
g_free (tmp);
|
2004-03-14 19:59:33 +01:00
|
|
|
continue;
|
|
|
|
}
|
2003-08-25 18:36:03 +02:00
|
|
|
if (wc == '\r')
|
|
|
|
{
|
|
|
|
safe = *(p + 1) == '\n';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
safe = CHAR_IS_SAFE (wc);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!safe)
|
|
|
|
{
|
|
|
|
gchar *tmp;
|
2004-04-22 22:17:54 +02:00
|
|
|
guint pos;
|
|
|
|
|
|
|
|
pos = p - string->str;
|
2003-08-25 18:36:03 +02:00
|
|
|
|
|
|
|
/* Largest char we escape is 0x0a, so we don't have to worry
|
|
|
|
* about 8-digit \Uxxxxyyyy
|
|
|
|
*/
|
|
|
|
tmp = g_strdup_printf ("\\u%04x", wc);
|
2004-04-22 22:17:54 +02:00
|
|
|
g_string_erase (string, pos, g_utf8_next_char (p) - p);
|
|
|
|
g_string_insert (string, pos, tmp);
|
2003-08-25 18:36:03 +02:00
|
|
|
g_free (tmp);
|
|
|
|
|
2004-04-22 22:17:54 +02:00
|
|
|
p = string->str + (pos + 6); /* Skip over escape sequence */
|
2003-08-25 18:36:03 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
p = g_utf8_next_char (p);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-13 04:29:18 +02:00
|
|
|
/**
|
|
|
|
* g_log_default_handler:
|
|
|
|
* @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
|
|
|
|
*
|
|
|
|
* 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
|
2013-10-21 16:09:13 +02:00
|
|
|
* or stdout and if the log level is fatal it calls abort(). It automatically
|
|
|
|
* prints a new-line character after the message, so one does not need to be
|
|
|
|
* manually included in @message.
|
2011-10-13 04:29:18 +02:00
|
|
|
*
|
2011-11-03 06:48:54 +01:00
|
|
|
* The behavior of this log handler can be influenced by a number of
|
|
|
|
* environment variables:
|
|
|
|
* <variablelist>
|
|
|
|
* <varlistentry>
|
|
|
|
* <term><envar>G_MESSAGES_PREFIXED</envar></term>
|
|
|
|
* <listitem>
|
|
|
|
* A :-separated list of log levels for which messages should
|
|
|
|
* be prefixed by the program name and PID of the aplication.
|
|
|
|
* </listitem>
|
|
|
|
* </varlistentry>
|
|
|
|
* <varlistentry>
|
|
|
|
* <term><envar>G_MESSAGES_DEBUG</envar></term>
|
|
|
|
* <listitem>
|
|
|
|
* A space-separated list of log domains for which debug and
|
|
|
|
* informational messages are printed. By default these
|
|
|
|
* messages are not printed.
|
|
|
|
* </listitem>
|
|
|
|
* </varlistentry>
|
|
|
|
* </variablelist>
|
|
|
|
*
|
2011-10-13 04:29:18 +02:00
|
|
|
* 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.
|
|
|
|
*/
|
2002-03-27 18:57:30 +01:00
|
|
|
void
|
|
|
|
g_log_default_handler (const gchar *log_domain,
|
|
|
|
GLogLevelFlags log_level,
|
|
|
|
const gchar *message,
|
|
|
|
gpointer unused_data)
|
|
|
|
{
|
|
|
|
gchar level_prefix[STRING_BUFFER_SIZE], *string;
|
|
|
|
GString *gstring;
|
2004-09-22 23:15:35 +02:00
|
|
|
int fd;
|
2011-11-03 06:48:54 +01:00
|
|
|
const gchar *domains;
|
|
|
|
|
|
|
|
if ((log_level & DEFAULT_LEVELS) || (log_level >> G_LOG_LEVEL_USER_SHIFT))
|
|
|
|
goto emit;
|
|
|
|
|
|
|
|
domains = g_getenv ("G_MESSAGES_DEBUG");
|
|
|
|
if (((log_level & INFO_LEVELS) == 0) ||
|
|
|
|
domains == NULL ||
|
2011-11-17 03:42:28 +01:00
|
|
|
(strcmp (domains, "all") != 0 && (!log_domain || !strstr (domains, log_domain))))
|
2011-11-03 06:48:54 +01:00
|
|
|
return;
|
2002-03-27 18:57:30 +01:00
|
|
|
|
2011-11-03 06:48:54 +01:00
|
|
|
emit:
|
2002-03-27 18:57:30 +01:00
|
|
|
/* we can be called externally with recursion for whatever reason */
|
|
|
|
if (log_level & G_LOG_FLAG_RECURSION)
|
|
|
|
{
|
|
|
|
_g_log_fallback_handler (log_domain, log_level, message, unused_data);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
fd = mklevel_prefix (level_prefix, log_level);
|
|
|
|
|
2003-03-31 00:02:20 +02:00
|
|
|
gstring = g_string_new (NULL);
|
2002-03-27 18:57:30 +01:00
|
|
|
if (log_level & ALERT_LEVELS)
|
|
|
|
g_string_append (gstring, "\n");
|
|
|
|
if (!log_domain)
|
|
|
|
g_string_append (gstring, "** ");
|
|
|
|
|
2012-03-14 01:10:39 +01:00
|
|
|
if ((g_log_msg_prefix & (log_level & G_LOG_LEVEL_MASK)) == (log_level & G_LOG_LEVEL_MASK))
|
2002-03-27 18:57:30 +01:00
|
|
|
{
|
|
|
|
const gchar *prg_name = g_get_prgname ();
|
|
|
|
|
|
|
|
if (!prg_name)
|
2002-03-29 00:24:23 +01:00
|
|
|
g_string_append_printf (gstring, "(process:%lu): ", (gulong)getpid ());
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
else
|
2002-03-29 00:24:23 +01:00
|
|
|
g_string_append_printf (gstring, "(%s:%lu): ", prg_name, (gulong)getpid ());
|
2002-03-27 18:57:30 +01:00
|
|
|
}
|
2001-05-09 18:36:17 +02:00
|
|
|
|
2002-03-27 18:57:30 +01:00
|
|
|
if (log_domain)
|
|
|
|
{
|
|
|
|
g_string_append (gstring, log_domain);
|
|
|
|
g_string_append_c (gstring, '-');
|
|
|
|
}
|
|
|
|
g_string_append (gstring, level_prefix);
|
2001-05-09 18:36:17 +02:00
|
|
|
|
2002-03-27 18:57:30 +01:00
|
|
|
g_string_append (gstring, ": ");
|
|
|
|
if (!message)
|
|
|
|
g_string_append (gstring, "(NULL) message");
|
|
|
|
else
|
|
|
|
{
|
2004-03-14 19:59:33 +01:00
|
|
|
GString *msg;
|
2002-03-27 18:57:30 +01:00
|
|
|
const gchar *charset;
|
|
|
|
|
2004-03-14 19:59:33 +01:00
|
|
|
msg = g_string_new (message);
|
|
|
|
escape_string (msg);
|
|
|
|
|
2002-03-27 18:57:30 +01:00
|
|
|
if (g_get_charset (&charset))
|
2004-03-14 19:59:33 +01:00
|
|
|
g_string_append (gstring, msg->str); /* charset is UTF-8 already */
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
else
|
|
|
|
{
|
2004-03-14 19:59:33 +01:00
|
|
|
string = strdup_convert (msg->str, charset);
|
2002-03-28 21:12:32 +01:00
|
|
|
g_string_append (gstring, string);
|
|
|
|
g_free (string);
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
}
|
2003-08-25 18:36:03 +02:00
|
|
|
|
2004-03-14 19:59:33 +01:00
|
|
|
g_string_free (msg, TRUE);
|
1998-06-11 01:21:14 +02:00
|
|
|
}
|
2011-04-26 19:04:25 +02:00
|
|
|
g_string_append (gstring, "\n");
|
2002-03-27 18:57:30 +01:00
|
|
|
|
|
|
|
string = g_string_free (gstring, FALSE);
|
|
|
|
|
|
|
|
write_string (fd, string);
|
|
|
|
g_free (string);
|
1998-06-11 01:21:14 +02:00
|
|
|
}
|
|
|
|
|
2011-07-20 02:40:28 +02:00
|
|
|
/**
|
|
|
|
* g_set_print_handler:
|
|
|
|
* @func: the new print handler
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* Returns: the old print handler
|
|
|
|
*/
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
GPrintFunc
|
|
|
|
g_set_print_handler (GPrintFunc func)
|
|
|
|
{
|
|
|
|
GPrintFunc old_print_func;
|
2011-07-20 02:40:28 +02:00
|
|
|
|
2011-09-17 23:56:33 +02:00
|
|
|
g_mutex_lock (&g_messages_lock);
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
old_print_func = glib_print_func;
|
|
|
|
glib_print_func = func;
|
2011-09-17 23:56:33 +02:00
|
|
|
g_mutex_unlock (&g_messages_lock);
|
2011-07-20 02:40:28 +02:00
|
|
|
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
return old_print_func;
|
|
|
|
}
|
|
|
|
|
2011-07-20 02:40:28 +02:00
|
|
|
/**
|
|
|
|
* g_print:
|
|
|
|
* @format: the message format. See the printf() documentation
|
2011-07-22 13:25:32 +02:00
|
|
|
* @...: the parameters to insert into the format string
|
2011-07-20 02:40:28 +02:00
|
|
|
*
|
|
|
|
* Outputs a formatted message via the print handler.
|
2013-10-21 16:09:13 +02:00
|
|
|
* The default print handler simply outputs the message to stdout, without
|
|
|
|
* appending a trailing new-line character. Typically, @format should end with
|
|
|
|
* its own new-line character.
|
2011-07-20 02:40:28 +02:00
|
|
|
*
|
|
|
|
* 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().
|
|
|
|
*/
|
1998-06-11 01:21:14 +02:00
|
|
|
void
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
g_print (const gchar *format,
|
2011-07-20 02:40:28 +02:00
|
|
|
...)
|
1998-06-11 01:21:14 +02:00
|
|
|
{
|
removed this function which was not publically exported in glib.h. to
Mon Aug 24 02:08:56 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gstring.c:
* gstrfuncs.c:
(g_vsprintf): removed this function which was not publically
exported in glib.h. to export it, it should have been named
differently in the first place, since its semantics differ from
vsprintf(). apart from that, it was a possible cause for
problems since it worked on a previously allocated memory area and
was used in a lot places of glib. exporting it would have been a
guararant for problems with threaded programs.
(g_printf_string_upper_bound): exported this function to return
a string size, guarranteed to be big enough to hold the fully
expanded format+args string. added 'q', 'L' and 'll' flag handling.
in fact, the newly allocated area is in most cases much bigger than
required.
(g_strdup_vprintf()): new function returning a newly allocated string
containing the contents of *format and associated args (size is
calculated with g_printf_string_upper_bound()).
(g_strdup_printf): new function which wraps g_strdup_vprintf().
* configure.in: check for va_copy() or __va_copy() alternatively.
check whether va_lists can be copyied by value.
* glib.h: provide a definition for G_VA_COPY.
* glib.h:
* gmessages.c:
(g_logv):
(g_vsnprintf):
pass va_lists by value, not by reference, since this causes problems
on platforms that implement va_list as as arrays. internaly, use
G_VA_COPY (new_arg, org_arg); va_end (new_arg); to produce a second
va_list variable, if multiple passes are required. changed all
callers.
* glib.h:
* gerror.h:
renamed g_debug() to g_on_error_query(), cleaned up a bit.
renamed g_stack_trace() to g_on_error_stack_trace() since both
functions cluttered different namespaces.
there is an appropriate comment in glib.h now that explains the
unix and gdb specific dependencies of both functions.
removed g_attach_process().
g_on_error_stack_trace() should probably be handled with caution,
i've seem several different linux versions (2.0.x) become unstable
after invokation of this function.
1998-08-24 07:26:53 +02:00
|
|
|
va_list args;
|
|
|
|
gchar *string;
|
1998-12-15 06:28:02 +01:00
|
|
|
GPrintFunc local_glib_print_func;
|
2011-07-20 02:40:28 +02:00
|
|
|
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
g_return_if_fail (format != NULL);
|
2011-07-20 02:40:28 +02:00
|
|
|
|
1998-06-11 01:21:14 +02:00
|
|
|
va_start (args, format);
|
removed this function which was not publically exported in glib.h. to
Mon Aug 24 02:08:56 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gstring.c:
* gstrfuncs.c:
(g_vsprintf): removed this function which was not publically
exported in glib.h. to export it, it should have been named
differently in the first place, since its semantics differ from
vsprintf(). apart from that, it was a possible cause for
problems since it worked on a previously allocated memory area and
was used in a lot places of glib. exporting it would have been a
guararant for problems with threaded programs.
(g_printf_string_upper_bound): exported this function to return
a string size, guarranteed to be big enough to hold the fully
expanded format+args string. added 'q', 'L' and 'll' flag handling.
in fact, the newly allocated area is in most cases much bigger than
required.
(g_strdup_vprintf()): new function returning a newly allocated string
containing the contents of *format and associated args (size is
calculated with g_printf_string_upper_bound()).
(g_strdup_printf): new function which wraps g_strdup_vprintf().
* configure.in: check for va_copy() or __va_copy() alternatively.
check whether va_lists can be copyied by value.
* glib.h: provide a definition for G_VA_COPY.
* glib.h:
* gmessages.c:
(g_logv):
(g_vsnprintf):
pass va_lists by value, not by reference, since this causes problems
on platforms that implement va_list as as arrays. internaly, use
G_VA_COPY (new_arg, org_arg); va_end (new_arg); to produce a second
va_list variable, if multiple passes are required. changed all
callers.
* glib.h:
* gerror.h:
renamed g_debug() to g_on_error_query(), cleaned up a bit.
renamed g_stack_trace() to g_on_error_stack_trace() since both
functions cluttered different namespaces.
there is an appropriate comment in glib.h now that explains the
unix and gdb specific dependencies of both functions.
removed g_attach_process().
g_on_error_stack_trace() should probably be handled with caution,
i've seem several different linux versions (2.0.x) become unstable
after invokation of this function.
1998-08-24 07:26:53 +02:00
|
|
|
string = g_strdup_vprintf (format, args);
|
1998-06-11 01:21:14 +02:00
|
|
|
va_end (args);
|
2011-07-20 02:40:28 +02:00
|
|
|
|
2011-09-17 23:56:33 +02:00
|
|
|
g_mutex_lock (&g_messages_lock);
|
1998-12-15 06:28:02 +01:00
|
|
|
local_glib_print_func = glib_print_func;
|
2011-09-17 23:56:33 +02:00
|
|
|
g_mutex_unlock (&g_messages_lock);
|
2011-07-20 02:40:28 +02:00
|
|
|
|
1998-12-15 06:28:02 +01:00
|
|
|
if (local_glib_print_func)
|
|
|
|
local_glib_print_func (string);
|
1998-06-11 01:21:14 +02:00
|
|
|
else
|
|
|
|
{
|
2002-03-28 21:12:32 +01:00
|
|
|
const gchar *charset;
|
|
|
|
|
|
|
|
if (g_get_charset (&charset))
|
2011-07-20 02:40:28 +02:00
|
|
|
fputs (string, stdout); /* charset is UTF-8 already */
|
2002-03-28 21:12:32 +01:00
|
|
|
else
|
2011-07-20 02:40:28 +02:00
|
|
|
{
|
|
|
|
gchar *lstring = strdup_convert (string, charset);
|
2002-03-28 21:12:32 +01:00
|
|
|
|
2011-07-20 02:40:28 +02:00
|
|
|
fputs (lstring, stdout);
|
|
|
|
g_free (lstring);
|
|
|
|
}
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
fflush (stdout);
|
1998-06-11 01:21:14 +02:00
|
|
|
}
|
removed this function which was not publically exported in glib.h. to
Mon Aug 24 02:08:56 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gstring.c:
* gstrfuncs.c:
(g_vsprintf): removed this function which was not publically
exported in glib.h. to export it, it should have been named
differently in the first place, since its semantics differ from
vsprintf(). apart from that, it was a possible cause for
problems since it worked on a previously allocated memory area and
was used in a lot places of glib. exporting it would have been a
guararant for problems with threaded programs.
(g_printf_string_upper_bound): exported this function to return
a string size, guarranteed to be big enough to hold the fully
expanded format+args string. added 'q', 'L' and 'll' flag handling.
in fact, the newly allocated area is in most cases much bigger than
required.
(g_strdup_vprintf()): new function returning a newly allocated string
containing the contents of *format and associated args (size is
calculated with g_printf_string_upper_bound()).
(g_strdup_printf): new function which wraps g_strdup_vprintf().
* configure.in: check for va_copy() or __va_copy() alternatively.
check whether va_lists can be copyied by value.
* glib.h: provide a definition for G_VA_COPY.
* glib.h:
* gmessages.c:
(g_logv):
(g_vsnprintf):
pass va_lists by value, not by reference, since this causes problems
on platforms that implement va_list as as arrays. internaly, use
G_VA_COPY (new_arg, org_arg); va_end (new_arg); to produce a second
va_list variable, if multiple passes are required. changed all
callers.
* glib.h:
* gerror.h:
renamed g_debug() to g_on_error_query(), cleaned up a bit.
renamed g_stack_trace() to g_on_error_stack_trace() since both
functions cluttered different namespaces.
there is an appropriate comment in glib.h now that explains the
unix and gdb specific dependencies of both functions.
removed g_attach_process().
g_on_error_stack_trace() should probably be handled with caution,
i've seem several different linux versions (2.0.x) become unstable
after invokation of this function.
1998-08-24 07:26:53 +02:00
|
|
|
g_free (string);
|
1998-06-11 01:21:14 +02:00
|
|
|
}
|
|
|
|
|
2011-07-20 02:40:28 +02:00
|
|
|
/**
|
|
|
|
* g_set_printerr_handler:
|
|
|
|
* @func: the new error message handler
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* Returns: the old error message handler
|
|
|
|
*/
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
GPrintFunc
|
|
|
|
g_set_printerr_handler (GPrintFunc func)
|
|
|
|
{
|
|
|
|
GPrintFunc old_printerr_func;
|
2011-07-20 02:40:28 +02:00
|
|
|
|
2011-09-17 23:56:33 +02:00
|
|
|
g_mutex_lock (&g_messages_lock);
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
old_printerr_func = glib_printerr_func;
|
|
|
|
glib_printerr_func = func;
|
2011-09-17 23:56:33 +02:00
|
|
|
g_mutex_unlock (&g_messages_lock);
|
2011-07-20 02:40:28 +02:00
|
|
|
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
return old_printerr_func;
|
|
|
|
}
|
|
|
|
|
2011-07-20 02:40:28 +02:00
|
|
|
/**
|
|
|
|
* g_printerr:
|
|
|
|
* @format: the message format. See the printf() documentation
|
2011-07-22 13:25:32 +02:00
|
|
|
* @...: the parameters to insert into the format string
|
2011-07-20 02:40:28 +02:00
|
|
|
*
|
|
|
|
* Outputs a formatted message via the error message handler.
|
2013-10-21 16:09:13 +02:00
|
|
|
* The default handler simply outputs the message to stderr, without appending
|
|
|
|
* a trailing new-line character. Typically, @format should end with its own
|
|
|
|
* new-line character.
|
2011-07-20 02:40:28 +02:00
|
|
|
*
|
|
|
|
* 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().
|
|
|
|
*/
|
1998-06-11 01:21:14 +02:00
|
|
|
void
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
g_printerr (const gchar *format,
|
2011-07-20 02:40:28 +02:00
|
|
|
...)
|
1998-06-11 01:21:14 +02:00
|
|
|
{
|
removed this function which was not publically exported in glib.h. to
Mon Aug 24 02:08:56 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gstring.c:
* gstrfuncs.c:
(g_vsprintf): removed this function which was not publically
exported in glib.h. to export it, it should have been named
differently in the first place, since its semantics differ from
vsprintf(). apart from that, it was a possible cause for
problems since it worked on a previously allocated memory area and
was used in a lot places of glib. exporting it would have been a
guararant for problems with threaded programs.
(g_printf_string_upper_bound): exported this function to return
a string size, guarranteed to be big enough to hold the fully
expanded format+args string. added 'q', 'L' and 'll' flag handling.
in fact, the newly allocated area is in most cases much bigger than
required.
(g_strdup_vprintf()): new function returning a newly allocated string
containing the contents of *format and associated args (size is
calculated with g_printf_string_upper_bound()).
(g_strdup_printf): new function which wraps g_strdup_vprintf().
* configure.in: check for va_copy() or __va_copy() alternatively.
check whether va_lists can be copyied by value.
* glib.h: provide a definition for G_VA_COPY.
* glib.h:
* gmessages.c:
(g_logv):
(g_vsnprintf):
pass va_lists by value, not by reference, since this causes problems
on platforms that implement va_list as as arrays. internaly, use
G_VA_COPY (new_arg, org_arg); va_end (new_arg); to produce a second
va_list variable, if multiple passes are required. changed all
callers.
* glib.h:
* gerror.h:
renamed g_debug() to g_on_error_query(), cleaned up a bit.
renamed g_stack_trace() to g_on_error_stack_trace() since both
functions cluttered different namespaces.
there is an appropriate comment in glib.h now that explains the
unix and gdb specific dependencies of both functions.
removed g_attach_process().
g_on_error_stack_trace() should probably be handled with caution,
i've seem several different linux versions (2.0.x) become unstable
after invokation of this function.
1998-08-24 07:26:53 +02:00
|
|
|
va_list args;
|
|
|
|
gchar *string;
|
1998-12-15 06:28:02 +01:00
|
|
|
GPrintFunc local_glib_printerr_func;
|
2011-07-20 02:40:28 +02:00
|
|
|
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
g_return_if_fail (format != NULL);
|
2011-07-20 02:40:28 +02:00
|
|
|
|
1998-06-11 01:21:14 +02:00
|
|
|
va_start (args, format);
|
removed this function which was not publically exported in glib.h. to
Mon Aug 24 02:08:56 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gstring.c:
* gstrfuncs.c:
(g_vsprintf): removed this function which was not publically
exported in glib.h. to export it, it should have been named
differently in the first place, since its semantics differ from
vsprintf(). apart from that, it was a possible cause for
problems since it worked on a previously allocated memory area and
was used in a lot places of glib. exporting it would have been a
guararant for problems with threaded programs.
(g_printf_string_upper_bound): exported this function to return
a string size, guarranteed to be big enough to hold the fully
expanded format+args string. added 'q', 'L' and 'll' flag handling.
in fact, the newly allocated area is in most cases much bigger than
required.
(g_strdup_vprintf()): new function returning a newly allocated string
containing the contents of *format and associated args (size is
calculated with g_printf_string_upper_bound()).
(g_strdup_printf): new function which wraps g_strdup_vprintf().
* configure.in: check for va_copy() or __va_copy() alternatively.
check whether va_lists can be copyied by value.
* glib.h: provide a definition for G_VA_COPY.
* glib.h:
* gmessages.c:
(g_logv):
(g_vsnprintf):
pass va_lists by value, not by reference, since this causes problems
on platforms that implement va_list as as arrays. internaly, use
G_VA_COPY (new_arg, org_arg); va_end (new_arg); to produce a second
va_list variable, if multiple passes are required. changed all
callers.
* glib.h:
* gerror.h:
renamed g_debug() to g_on_error_query(), cleaned up a bit.
renamed g_stack_trace() to g_on_error_stack_trace() since both
functions cluttered different namespaces.
there is an appropriate comment in glib.h now that explains the
unix and gdb specific dependencies of both functions.
removed g_attach_process().
g_on_error_stack_trace() should probably be handled with caution,
i've seem several different linux versions (2.0.x) become unstable
after invokation of this function.
1998-08-24 07:26:53 +02:00
|
|
|
string = g_strdup_vprintf (format, args);
|
1998-06-11 01:21:14 +02:00
|
|
|
va_end (args);
|
2011-07-20 02:40:28 +02:00
|
|
|
|
2011-09-17 23:56:33 +02:00
|
|
|
g_mutex_lock (&g_messages_lock);
|
1998-12-15 06:28:02 +01:00
|
|
|
local_glib_printerr_func = glib_printerr_func;
|
2011-09-17 23:56:33 +02:00
|
|
|
g_mutex_unlock (&g_messages_lock);
|
2011-07-20 02:40:28 +02:00
|
|
|
|
1998-12-15 06:28:02 +01:00
|
|
|
if (local_glib_printerr_func)
|
|
|
|
local_glib_printerr_func (string);
|
1998-06-11 01:21:14 +02:00
|
|
|
else
|
|
|
|
{
|
2002-03-28 21:12:32 +01:00
|
|
|
const gchar *charset;
|
|
|
|
|
|
|
|
if (g_get_charset (&charset))
|
2011-07-20 02:40:28 +02:00
|
|
|
fputs (string, stderr); /* charset is UTF-8 already */
|
2002-03-28 21:12:32 +01:00
|
|
|
else
|
2011-07-20 02:40:28 +02:00
|
|
|
{
|
|
|
|
gchar *lstring = strdup_convert (string, charset);
|
2002-03-28 21:12:32 +01:00
|
|
|
|
2011-07-20 02:40:28 +02:00
|
|
|
fputs (lstring, stderr);
|
|
|
|
g_free (lstring);
|
|
|
|
}
|
version bump to 1.1.3, binary age 0, interface age 0.
Sun Aug 16 20:28:27 1998 Tim Janik <timj@gtk.org>
* version bump to 1.1.3, binary age 0, interface age 0.
* glib.h: be nice to platforms that don't have gint64 and don't
issue #warning on every compilation. since glib doesn't require
gint64 itself, packages that need gint64 should test for this
themselves.
* glib.h:
* gutils.c: added a new function g_vsnprintf().
Fri Aug 14 16:41:53 1998 Tim Janik <timj@gtk.org>
* glib.h: added static inline functions for bit mask tests:
g_bit_nth_lsf, g_bit_nth_msf and g_bit_storage.
Fri Aug 13 14:23:37 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gmessages.c:
revised the message handling system, which is now based on a new
mechanism g_log*. most of the assertment macros got adapted to
feature the new g_log() call with an additional specification of
the log level in a preprocessor macro G_LOG_DOMAIN. if G_LOG_DOMAIN
is undefined upon the includion of glib.h, it'll be defined with a
value of (NULL) and thus preserves the original bahaviour for
warning and error messages. the message handler setting functions
for g_warning, g_error and g_message are only provided for backwards
compatibility and might get removed somewhen.
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GLib" upon compilation. we currently have to add this definition
to the DEFS variable.
* testglib.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
* glib.h: changed some gints to gbooleans, made a few const corrections,
removed some superfluous G_STMT_START{}G_STMT_END wrappers, added some
in other required places.
* gnode.c:
(g_node_prepend):
(g_node_insert_before):
(g_node_insert):
(g_node_append_data):
(g_node_prepend_data):
(g_node_insert_data_before):
(g_node_insert_data):
(g_node_append):
return (node), so these macros/functions can be usefully chained with
g_node_new().
[GModule]
Fri Aug 14 02:24:39 1998 Tim Janik <timj@gtk.org>
* Makefile.am: feature the G_LOG_DOMAIN macro to set the log domain
to "GModule" upon compilation. we currently have to add this definition
to the DEFS variable.
* testgmodule.c: we need an ugly #undef G_LOG_DOMAIN at the start
of this file currently, since automake doesn't support per target
_CFLAGS yet.
1998-08-16 23:14:11 +02:00
|
|
|
fflush (stderr);
|
1998-06-11 01:21:14 +02:00
|
|
|
}
|
removed this function which was not publically exported in glib.h. to
Mon Aug 24 02:08:56 1998 Tim Janik <timj@gtk.org>
* glib.h:
* gstring.c:
* gstrfuncs.c:
(g_vsprintf): removed this function which was not publically
exported in glib.h. to export it, it should have been named
differently in the first place, since its semantics differ from
vsprintf(). apart from that, it was a possible cause for
problems since it worked on a previously allocated memory area and
was used in a lot places of glib. exporting it would have been a
guararant for problems with threaded programs.
(g_printf_string_upper_bound): exported this function to return
a string size, guarranteed to be big enough to hold the fully
expanded format+args string. added 'q', 'L' and 'll' flag handling.
in fact, the newly allocated area is in most cases much bigger than
required.
(g_strdup_vprintf()): new function returning a newly allocated string
containing the contents of *format and associated args (size is
calculated with g_printf_string_upper_bound()).
(g_strdup_printf): new function which wraps g_strdup_vprintf().
* configure.in: check for va_copy() or __va_copy() alternatively.
check whether va_lists can be copyied by value.
* glib.h: provide a definition for G_VA_COPY.
* glib.h:
* gmessages.c:
(g_logv):
(g_vsnprintf):
pass va_lists by value, not by reference, since this causes problems
on platforms that implement va_list as as arrays. internaly, use
G_VA_COPY (new_arg, org_arg); va_end (new_arg); to produce a second
va_list variable, if multiple passes are required. changed all
callers.
* glib.h:
* gerror.h:
renamed g_debug() to g_on_error_query(), cleaned up a bit.
renamed g_stack_trace() to g_on_error_stack_trace() since both
functions cluttered different namespaces.
there is an appropriate comment in glib.h now that explains the
unix and gdb specific dependencies of both functions.
removed g_attach_process().
g_on_error_stack_trace() should probably be handled with caution,
i've seem several different linux versions (2.0.x) become unstable
after invokation of this function.
1998-08-24 07:26:53 +02:00
|
|
|
g_free (string);
|
1998-06-11 01:21:14 +02:00
|
|
|
}
|
|
|
|
|
2011-10-02 05:38:52 +02:00
|
|
|
/**
|
|
|
|
* g_printf_string_upper_bound:
|
|
|
|
* @format: the format string. See the printf() documentation
|
|
|
|
* @args: the parameters to be inserted into the format string
|
|
|
|
*
|
|
|
|
* Calculates the maximum space needed to store the output
|
|
|
|
* of the sprintf() function.
|
|
|
|
*
|
|
|
|
* Returns: the maximum space needed to store the formatted string
|
|
|
|
*/
|
Changes for 64-bit cleanliness, loosely based on patch from Mark Murnane.
Wed Jun 20 12:00:54 2001 Owen Taylor <otaylor@redhat.com>
Changes for 64-bit cleanliness, loosely based on patch
from Mark Murnane.
* gconvert.c (g_convert/g_convert_with_fallback): Remove
workarounds for since-fixed GNU libc bugs. Minor
doc fix.
* gconvert.[ch]: Change gint to gsize/gssize as
appropriate.
* gconvert.c (g_locale/filename_to/from_utf8): Fix incorrect
computation of bytes_read / bytes_written.
* gfileutils.[ch] (g_file_get_contents): Make length
out parameter 'gsize *len'.
* ghook.c (g_hook_compare_ids): Don't compare a
and b as 'a - b'.
* gmacros.h (GSIZE_TO_POINTER): Add GPOINTER_TO_SIZE,
GSIZE_TO_POINTER.
* gmain.c (g_timeout_prepare): Rewrite to avoid
overflows. (Fixes bug when system clock skews
backwards more than 24 days.)
* gmarkup.[ch]: Make lengths passed to callbacks
gsize, length for g_markup_parse-context_parse(),
g_markup_escape_text() gssize.
* gmessages.[ch] (g_printf_string_upper_bound): Change
return value to gsize.
* gmessages.c (printf_string_upper_bound): Remove
a ridiculous use of 'inline' on a 300 line function.
* gstring.[ch]: Represent size of string as a gsize,
not gint. Make parameters to functions take gsize,
or gssize where -1 is allowed.
* gstring.c (g_string_erase): Make
g_string_erase (string, pos, -1) a synonym for
g_string_truncate for consistency with other G*
APIs.
* gstrfuncs.[ch]: Make all functions taking a string
length, take a gsize, or gssize if -1 is allowed.
(g_strstr_len, g_strrstr_len). Also fix some boundary
conditions in g_str[r]str[_len].
* gutf8.c tests/unicode-encoding.c: Make parameters that
are byte lengths gsize, gssize as appropriate. Make
character offsets, other counts, glong.
* gasyncqueue.c gcompletion.c
timeloop.c timeloop-basic.c gutils.c gspawn.c.
Small 64 bit cleanliness fixups.
* glist.c (g_list_sort2, g_list_sort_real): Fix functions
that should have been static.
* gdate.c (g_date_fill_parse_tokens): Fix extra
declaration that was shadowing another.
* tests/module-test.c: Include string.h
Mon Jun 18 15:43:29 2001 Owen Taylor <otaylor@redhat.com>
* gutf8.c (g_get_charset): Make argument
G_CONST_RETURN char **.
2001-06-23 15:55:09 +02:00
|
|
|
gsize
|
1999-10-12 14:08:13 +02:00
|
|
|
g_printf_string_upper_bound (const gchar *format,
|
2011-10-02 05:38:52 +02:00
|
|
|
va_list args)
|
1999-10-12 14:08:13 +02:00
|
|
|
{
|
2001-12-06 23:37:05 +01:00
|
|
|
gchar c;
|
2002-11-21 01:35:15 +01:00
|
|
|
return _g_vsnprintf (&c, 1, format, args) + 1;
|
1999-10-12 14:08:13 +02:00
|
|
|
}
|
2013-05-20 15:31:48 +02:00
|
|
|
|
|
|
|
void
|
|
|
|
_g_log_set_exit_on_fatal (void)
|
|
|
|
{
|
|
|
|
exit_on_fatal = TRUE;
|
|
|
|
}
|