36
37
<th width="100%" align="center">GLib Reference Manual</th>
37
38
<td><a accesskey="n" href="glib-utilities.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
39
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id3013606" class="shortcut">Top</a>
41
<a href="#id3014042" class="shortcut">Description</a></nobr></td></tr>
40
<tr><td colspan="5" class="shortcuts">
41
<a href="#glib-Message-Logging.synopsis" class="shortcut">Top</a>
43
<a href="#glib-Message-Logging.description" class="shortcut">Description</a>
43
46
<div class="refentry" lang="en">
44
47
<a name="glib-Message-Logging"></a><div class="titlepage"></div>
45
48
<div class="refnamediv"><table width="100%"><tr>
48
<a name="id3013606"></a><span class="refentrytitle">Message Logging</span>
50
<p>Message Logging — versatile support for logging messages with different levels of importance</p>
50
<h2><span class="refentrytitle"><a name="glib-Message-Logging.top_of_page"></a>Message Logging</span></h2>
51
<p>Message Logging — versatile support for logging messages with different levels of importance</p>
52
53
<td valign="top" align="right"></td>
53
54
</tr></table></div>
54
55
<div class="refsynopsisdiv">
56
<a name="glib-Message-Logging.synopsis"></a><h2>Synopsis</h2>
56
57
<pre class="synopsis">
58
59
#include <glib.h>
61
#define <a class="link" href="glib-Message-Logging.html#G-LOG-DOMAIN:CAPS">G_LOG_DOMAIN</a>
62
#define <a class="link" href="glib-Message-Logging.html#G-LOG-FATAL-MASK:CAPS">G_LOG_FATAL_MASK</a>
63
#define <a class="link" href="glib-Message-Logging.html#G-LOG-LEVEL-USER-SHIFT:CAPS">G_LOG_LEVEL_USER_SHIFT</a>
64
void (<a class="link" href="glib-Message-Logging.html#GLogFunc">*GLogFunc</a>) (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *log_domain,
65
<a class="link" href="glib-Message-Logging.html#GLogLevelFlags">GLogLevelFlags</a> log_level,
66
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *message,
67
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);
68
enum <a class="link" href="glib-Message-Logging.html#GLogLevelFlags">GLogLevelFlags</a>;
70
void <a class="link" href="glib-Message-Logging.html#g-log">g_log</a> (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *log_domain,
71
<a class="link" href="glib-Message-Logging.html#GLogLevelFlags">GLogLevelFlags</a> log_level,
72
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *format,
61
#define <a class="link" href="glib-Message-Logging.html#G-LOG-DOMAIN--CAPS" title="G_LOG_DOMAIN">G_LOG_DOMAIN</a>
62
#define <a class="link" href="glib-Message-Logging.html#G-LOG-FATAL-MASK--CAPS" title="G_LOG_FATAL_MASK">G_LOG_FATAL_MASK</a>
63
#define <a class="link" href="glib-Message-Logging.html#G-LOG-LEVEL-USER-SHIFT--CAPS" title="G_LOG_LEVEL_USER_SHIFT">G_LOG_LEVEL_USER_SHIFT</a>
64
void (<a class="link" href="glib-Message-Logging.html#GLogFunc" title="GLogFunc ()">*GLogFunc</a>) (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *log_domain,
65
<a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags">GLogLevelFlags</a> log_level,
66
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *message,
67
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> user_data);
68
enum <a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags">GLogLevelFlags</a>;
70
void <a class="link" href="glib-Message-Logging.html#g-log" title="g_log ()">g_log</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *log_domain,
71
<a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags">GLogLevelFlags</a> log_level,
72
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *format,
74
void <a class="link" href="glib-Message-Logging.html#g-logv">g_logv</a> (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *log_domain,
75
<a class="link" href="glib-Message-Logging.html#GLogLevelFlags">GLogLevelFlags</a> log_level,
76
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *format,
74
void <a class="link" href="glib-Message-Logging.html#g-logv" title="g_logv ()">g_logv</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *log_domain,
75
<a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags">GLogLevelFlags</a> log_level,
76
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *format,
78
#define <a class="link" href="glib-Message-Logging.html#g-message">g_message</a> (...)
79
#define <a class="link" href="glib-Message-Logging.html#g-warning">g_warning</a> (...)
80
#define <a class="link" href="glib-Message-Logging.html#g-critical">g_critical</a> (...)
81
#define <a class="link" href="glib-Message-Logging.html#g-error">g_error</a> (...)
82
#define <a class="link" href="glib-Message-Logging.html#g-debug">g_debug</a> (...)
78
#define <a class="link" href="glib-Message-Logging.html#g-message" title="g_message()">g_message</a> (...)
79
#define <a class="link" href="glib-Message-Logging.html#g-warning" title="g_warning()">g_warning</a> (...)
80
#define <a class="link" href="glib-Message-Logging.html#g-critical" title="g_critical()">g_critical</a> (...)
81
#define <a class="link" href="glib-Message-Logging.html#g-error" title="g_error()">g_error</a> (...)
82
#define <a class="link" href="glib-Message-Logging.html#g-debug" title="g_debug()">g_debug</a> (...)
84
<a class="link" href="glib-Basic-Types.html#guint">guint</a> <a class="link" href="glib-Message-Logging.html#g-log-set-handler">g_log_set_handler</a> (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *log_domain,
85
<a class="link" href="glib-Message-Logging.html#GLogLevelFlags">GLogLevelFlags</a> log_levels,
86
<a class="link" href="glib-Message-Logging.html#GLogFunc">GLogFunc</a> log_func,
87
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);
88
void <a class="link" href="glib-Message-Logging.html#g-log-remove-handler">g_log_remove_handler</a> (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *log_domain,
89
<a class="link" href="glib-Basic-Types.html#guint">guint</a> handler_id);
90
<a class="link" href="glib-Message-Logging.html#GLogLevelFlags">GLogLevelFlags</a> <a class="link" href="glib-Message-Logging.html#g-log-set-always-fatal">g_log_set_always_fatal</a> (<a class="link" href="glib-Message-Logging.html#GLogLevelFlags">GLogLevelFlags</a> fatal_mask);
91
<a class="link" href="glib-Message-Logging.html#GLogLevelFlags">GLogLevelFlags</a> <a class="link" href="glib-Message-Logging.html#g-log-set-fatal-mask">g_log_set_fatal_mask</a> (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *log_domain,
92
<a class="link" href="glib-Message-Logging.html#GLogLevelFlags">GLogLevelFlags</a> fatal_mask);
93
void <a class="link" href="glib-Message-Logging.html#g-log-default-handler">g_log_default_handler</a> (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *log_domain,
94
<a class="link" href="glib-Message-Logging.html#GLogLevelFlags">GLogLevelFlags</a> log_level,
95
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *message,
96
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> unused_data);
97
<a class="link" href="glib-Message-Logging.html#GLogFunc">GLogFunc</a> <a class="link" href="glib-Message-Logging.html#g-log-set-default-handler">g_log_set_default_handler</a> (<a class="link" href="glib-Message-Logging.html#GLogFunc">GLogFunc</a> log_func,
98
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);
84
<a class="link" href="glib-Basic-Types.html#guint" title="guint">guint</a> <a class="link" href="glib-Message-Logging.html#g-log-set-handler" title="g_log_set_handler ()">g_log_set_handler</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *log_domain,
85
<a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags">GLogLevelFlags</a> log_levels,
86
<a class="link" href="glib-Message-Logging.html#GLogFunc" title="GLogFunc ()">GLogFunc</a> log_func,
87
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> user_data);
88
void <a class="link" href="glib-Message-Logging.html#g-log-remove-handler" title="g_log_remove_handler ()">g_log_remove_handler</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *log_domain,
89
<a class="link" href="glib-Basic-Types.html#guint" title="guint">guint</a> handler_id);
90
<a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags">GLogLevelFlags</a> <a class="link" href="glib-Message-Logging.html#g-log-set-always-fatal" title="g_log_set_always_fatal ()">g_log_set_always_fatal</a> (<a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags">GLogLevelFlags</a> fatal_mask);
91
<a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags">GLogLevelFlags</a> <a class="link" href="glib-Message-Logging.html#g-log-set-fatal-mask" title="g_log_set_fatal_mask ()">g_log_set_fatal_mask</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *log_domain,
92
<a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags">GLogLevelFlags</a> fatal_mask);
93
void <a class="link" href="glib-Message-Logging.html#g-log-default-handler" title="g_log_default_handler ()">g_log_default_handler</a> (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *log_domain,
94
<a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags">GLogLevelFlags</a> log_level,
95
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *message,
96
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> unused_data);
97
<a class="link" href="glib-Message-Logging.html#GLogFunc" title="GLogFunc ()">GLogFunc</a> <a class="link" href="glib-Message-Logging.html#g-log-set-default-handler" title="g_log_set_default_handler ()">g_log_set_default_handler</a> (<a class="link" href="glib-Message-Logging.html#GLogFunc" title="GLogFunc ()">GLogFunc</a> log_func,
98
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> user_data);
101
101
<div class="refsect1" lang="en">
102
<a name="id3014042"></a><h2>Description</h2>
102
<a name="glib-Message-Logging.description"></a><h2>Description</h2>
104
These functions provide support for logging error messages or messages
104
These functions provide support for logging error messages or messages
108
There are several built-in levels of messages, defined in <a class="link" href="glib-Message-Logging.html#GLogLevelFlags"><span class="type">GLogLevelFlags</span></a>.
108
There are several built-in levels of messages, defined in <a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags"><span class="type">GLogLevelFlags</span></a>.
109
109
These can be extended with user-defined levels.
112
112
<div class="refsect1" lang="en">
113
<a name="id3014072"></a><h2>Details</h2>
113
<a name="glib-Message-Logging.details"></a><h2>Details</h2>
114
114
<div class="refsect2" lang="en">
115
<a name="id3014082"></a><h3>
116
<a name="G-LOG-DOMAIN:CAPS"></a>G_LOG_DOMAIN</h3>
117
<a class="indexterm" name="id3014095"></a><pre class="programlisting">#define G_LOG_DOMAIN ((gchar*) 0)
115
<a name="G-LOG-DOMAIN--CAPS"></a><h3>G_LOG_DOMAIN</h3>
116
<pre class="programlisting">#define G_LOG_DOMAIN ((gchar*) 0)
120
119
Defines the log domain.
121
For applications, this is typically left as the default <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> (or "") domain.
120
For applications, this is typically left as the default <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a> (or "") domain.
122
121
Libraries should define this so that any messages which they log can
123
122
be differentiated from messages from other libraries and application code.
124
123
But be careful not to define it in any public header files.
215
208
Flags specifying the level of log messages. It is possible to change
216
how GLib treats messages of the various levels using <a class="link" href="glib-Message-Logging.html#g-log-set-handler"><code class="function">g_log_set_handler()</code></a>
217
and <a class="link" href="glib-Message-Logging.html#g-log-set-fatal-mask"><code class="function">g_log_set_fatal_mask()</code></a>.
209
how GLib treats messages of the various levels using <a class="link" href="glib-Message-Logging.html#g-log-set-handler" title="g_log_set_handler ()"><code class="function">g_log_set_handler()</code></a>
210
and <a class="link" href="glib-Message-Logging.html#g-log-set-fatal-mask" title="g_log_set_fatal_mask ()"><code class="function">g_log_set_fatal_mask()</code></a>.
219
212
<div class="variablelist"><table border="0">
220
213
<col align="left" valign="top">
223
<td><p><span class="term"><a name="G-LOG-FLAG-RECURSION:CAPS"></a><code class="literal">G_LOG_FLAG_RECURSION</code></span></p></td>
228
<td><p><span class="term"><a name="G-LOG-FLAG-FATAL:CAPS"></a><code class="literal">G_LOG_FLAG_FATAL</code></span></p></td>
233
<td><p><span class="term"><a name="G-LOG-LEVEL-ERROR:CAPS"></a><code class="literal">G_LOG_LEVEL_ERROR</code></span></p></td>
234
<td>log level for errors, see <a class="link" href="glib-Message-Logging.html#g-error"><code class="function">g_error()</code></a>.
235
This level is also used for messages produced by <a class="link" href="glib-Testing.html#g-assert"><code class="function">g_assert()</code></a>.
239
<td><p><span class="term"><a name="G-LOG-LEVEL-CRITICAL:CAPS"></a><code class="literal">G_LOG_LEVEL_CRITICAL</code></span></p></td>
240
<td>log level for critical messages, see <a class="link" href="glib-Message-Logging.html#g-critical"><code class="function">g_critical()</code></a>.
241
This level is also used for messages produced by <a class="link" href="glib-Warnings-and-Assertions.html#g-return-if-fail"><code class="function">g_return_if_fail()</code></a> and
242
<a class="link" href="glib-Warnings-and-Assertions.html#g-return-val-if-fail"><code class="function">g_return_val_if_fail()</code></a>.
246
<td><p><span class="term"><a name="G-LOG-LEVEL-WARNING:CAPS"></a><code class="literal">G_LOG_LEVEL_WARNING</code></span></p></td>
247
<td>log level for warnings, see <a class="link" href="glib-Message-Logging.html#g-warning"><code class="function">g_warning()</code></a>
251
<td><p><span class="term"><a name="G-LOG-LEVEL-MESSAGE:CAPS"></a><code class="literal">G_LOG_LEVEL_MESSAGE</code></span></p></td>
252
<td>log level for messages, see <a class="link" href="glib-Message-Logging.html#g-message"><code class="function">g_message()</code></a>
256
<td><p><span class="term"><a name="G-LOG-LEVEL-INFO:CAPS"></a><code class="literal">G_LOG_LEVEL_INFO</code></span></p></td>
216
<td><p><a name="G-LOG-FLAG-RECURSION--CAPS"></a><span class="term"><code class="literal">G_LOG_FLAG_RECURSION</code></span></p></td>
221
<td><p><a name="G-LOG-FLAG-FATAL--CAPS"></a><span class="term"><code class="literal">G_LOG_FLAG_FATAL</code></span></p></td>
226
<td><p><a name="G-LOG-LEVEL-ERROR--CAPS"></a><span class="term"><code class="literal">G_LOG_LEVEL_ERROR</code></span></p></td>
227
<td>log level for errors, see <a class="link" href="glib-Message-Logging.html#g-error" title="g_error()"><code class="function">g_error()</code></a>.
228
This level is also used for messages produced by <a class="link" href="glib-Testing.html#g-assert" title="g_assert()"><code class="function">g_assert()</code></a>.
232
<td><p><a name="G-LOG-LEVEL-CRITICAL--CAPS"></a><span class="term"><code class="literal">G_LOG_LEVEL_CRITICAL</code></span></p></td>
233
<td>log level for critical messages, see <a class="link" href="glib-Message-Logging.html#g-critical" title="g_critical()"><code class="function">g_critical()</code></a>.
234
This level is also used for messages produced by <a class="link" href="glib-Warnings-and-Assertions.html#g-return-if-fail" title="g_return_if_fail()"><code class="function">g_return_if_fail()</code></a> and
235
<a class="link" href="glib-Warnings-and-Assertions.html#g-return-val-if-fail" title="g_return_val_if_fail()"><code class="function">g_return_val_if_fail()</code></a>.
239
<td><p><a name="G-LOG-LEVEL-WARNING--CAPS"></a><span class="term"><code class="literal">G_LOG_LEVEL_WARNING</code></span></p></td>
240
<td>log level for warnings, see <a class="link" href="glib-Message-Logging.html#g-warning" title="g_warning()"><code class="function">g_warning()</code></a>
244
<td><p><a name="G-LOG-LEVEL-MESSAGE--CAPS"></a><span class="term"><code class="literal">G_LOG_LEVEL_MESSAGE</code></span></p></td>
245
<td>log level for messages, see <a class="link" href="glib-Message-Logging.html#g-message" title="g_message()"><code class="function">g_message()</code></a>
249
<td><p><a name="G-LOG-LEVEL-INFO--CAPS"></a><span class="term"><code class="literal">G_LOG_LEVEL_INFO</code></span></p></td>
257
250
<td>log level for informational messages
261
<td><p><span class="term"><a name="G-LOG-LEVEL-DEBUG:CAPS"></a><code class="literal">G_LOG_LEVEL_DEBUG</code></span></p></td>
262
<td>log level for debug messages, see <a class="link" href="glib-Message-Logging.html#g-debug"><code class="function">g_debug()</code></a>
254
<td><p><a name="G-LOG-LEVEL-DEBUG--CAPS"></a><span class="term"><code class="literal">G_LOG_LEVEL_DEBUG</code></span></p></td>
255
<td>log level for debug messages, see <a class="link" href="glib-Message-Logging.html#g-debug" title="g_debug()"><code class="function">g_debug()</code></a>
266
<td><p><span class="term"><a name="G-LOG-LEVEL-MASK:CAPS"></a><code class="literal">G_LOG_LEVEL_MASK</code></span></p></td>
259
<td><p><a name="G-LOG-LEVEL-MASK--CAPS"></a><span class="term"><code class="literal">G_LOG_LEVEL_MASK</code></span></p></td>
267
260
<td>a mask including all log levels.
441
417
<div class="variablelist"><table border="0">
442
418
<col align="left" valign="top">
444
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
420
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
445
421
<td>format string, followed by parameters to insert into the format string (as with <code class="function">printf()</code>)
453
427
<div class="refsect2" lang="en">
454
<a name="id3015329"></a><h3>
455
<a name="g-debug"></a>g_debug()</h3>
456
<a class="indexterm" name="id3015344"></a><pre class="programlisting">#define g_debug(...)</pre>
428
<a name="g-debug"></a><h3>g_debug()</h3>
429
<pre class="programlisting">#define g_debug(...)</pre>
458
431
A convenience function/macro to log a debug message.
460
433
<div class="variablelist"><table border="0">
461
434
<col align="left" valign="top">
463
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
436
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
464
437
<td>format string, followed by parameters to insert into the format string (as with <code class="function">printf()</code>)
468
<p class="since">Since 2.6
441
<p class="since">Since 2.6</p>
474
444
<div class="refsect2" lang="en">
475
<a name="id3015396"></a><h3>
476
<a name="g-log-set-handler"></a>g_log_set_handler ()</h3>
477
<a class="indexterm" name="id3015410"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint">guint</a> g_log_set_handler (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *log_domain,
478
<a class="link" href="glib-Message-Logging.html#GLogLevelFlags">GLogLevelFlags</a> log_levels,
479
<a class="link" href="glib-Message-Logging.html#GLogFunc">GLogFunc</a> log_func,
480
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);</pre>
445
<a name="g-log-set-handler"></a><h3>g_log_set_handler ()</h3>
446
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint" title="guint">guint</a> g_log_set_handler (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *log_domain,
447
<a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags">GLogLevelFlags</a> log_levels,
448
<a class="link" href="glib-Message-Logging.html#GLogFunc" title="GLogFunc ()">GLogFunc</a> log_func,
449
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> user_data);</pre>
482
451
Sets the log handler for a domain and a set of log levels.
483
452
To handle fatal and recursive messages the <em class="parameter"><code>log_levels</code></em> parameter
484
must be combined with the <a class="link" href="glib-Message-Logging.html#G-LOG-FLAG-FATAL:CAPS"><span class="type">G_LOG_FLAG_FATAL</span></a> and <a class="link" href="glib-Message-Logging.html#G-LOG-FLAG-RECURSION:CAPS"><span class="type">G_LOG_FLAG_RECURSION</span></a>
453
must be combined with the <a class="link" href="glib-Message-Logging.html#G-LOG-FLAG-FATAL--CAPS"><span class="type">G_LOG_FLAG_FATAL</span></a> and <a class="link" href="glib-Message-Logging.html#G-LOG-FLAG-RECURSION--CAPS"><span class="type">G_LOG_FLAG_RECURSION</span></a>
488
Note that since the <a class="link" href="glib-Message-Logging.html#G-LOG-LEVEL-ERROR:CAPS"><span class="type">G_LOG_LEVEL_ERROR</span></a> log level is always fatal, if
489
you want to set a handler for this log level you must combine it with
490
<a class="link" href="glib-Message-Logging.html#G-LOG-FLAG-FATAL:CAPS"><span class="type">G_LOG_FLAG_FATAL</span></a>.
457
Note that since the <a class="link" href="glib-Message-Logging.html#G-LOG-LEVEL-ERROR--CAPS"><span class="type">G_LOG_LEVEL_ERROR</span></a> log level is always fatal, if
458
you want to set a handler for this log level you must combine it with
459
<a class="link" href="glib-Message-Logging.html#G-LOG-FLAG-FATAL--CAPS"><span class="type">G_LOG_FLAG_FATAL</span></a>.
492
461
<div class="example">
493
<a name="id3015514"></a><p class="title"><b>Example 12. Adding a log handler for all warning messages in the default
462
<a name="id3051441"></a><p class="title"><b>Example 12. Adding a log handler for all warning messages in the default
494
463
(application) domain</b></p>
495
464
<div class="example-contents"><pre class="programlisting">
496
465
g_log_set_handler (NULL, G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL
646
604
<div class="refsect2" lang="en">
647
<a name="id3015973"></a><h3>
648
<a name="g-log-default-handler"></a>g_log_default_handler ()</h3>
649
<a class="indexterm" name="id3015986"></a><pre class="programlisting">void g_log_default_handler (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *log_domain,
650
<a class="link" href="glib-Message-Logging.html#GLogLevelFlags">GLogLevelFlags</a> log_level,
651
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *message,
652
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> unused_data);</pre>
605
<a name="g-log-default-handler"></a><h3>g_log_default_handler ()</h3>
606
<pre class="programlisting">void g_log_default_handler (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *log_domain,
607
<a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags">GLogLevelFlags</a> log_level,
608
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *message,
609
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> unused_data);</pre>
654
The default log handler set up by GLib; <a class="link" href="glib-Message-Logging.html#g-log-set-default-handler"><code class="function">g_log_set_default_handler()</code></a>
611
The default log handler set up by GLib; <a class="link" href="glib-Message-Logging.html#g-log-set-default-handler" title="g_log_set_default_handler ()"><code class="function">g_log_set_default_handler()</code></a>
655
612
allows to install an alternate default log handler.
656
613
This is used if no log handler has been set for the particular log domain
657
614
and log level combination. It outputs the message to stderr or stdout
658
615
and if the log level is fatal it calls <code class="function">abort()</code>.
661
stderr is used for levels <a class="link" href="glib-Message-Logging.html#G-LOG-LEVEL-ERROR:CAPS"><code class="literal">G_LOG_LEVEL_ERROR</code></a>, <a class="link" href="glib-Message-Logging.html#G-LOG-LEVEL-CRITICAL:CAPS"><code class="literal">G_LOG_LEVEL_CRITICAL</code></a>,
662
<a class="link" href="glib-Message-Logging.html#G-LOG-LEVEL-WARNING:CAPS"><code class="literal">G_LOG_LEVEL_WARNING</code></a> and <a class="link" href="glib-Message-Logging.html#G-LOG-LEVEL-MESSAGE:CAPS"><code class="literal">G_LOG_LEVEL_MESSAGE</code></a>. stdout is used for the rest.
618
stderr is used for levels <a class="link" href="glib-Message-Logging.html#G-LOG-LEVEL-ERROR--CAPS"><code class="literal">G_LOG_LEVEL_ERROR</code></a>, <a class="link" href="glib-Message-Logging.html#G-LOG-LEVEL-CRITICAL--CAPS"><code class="literal">G_LOG_LEVEL_CRITICAL</code></a>,
619
<a class="link" href="glib-Message-Logging.html#G-LOG-LEVEL-WARNING--CAPS"><code class="literal">G_LOG_LEVEL_WARNING</code></a> and <a class="link" href="glib-Message-Logging.html#G-LOG-LEVEL-MESSAGE--CAPS"><code class="literal">G_LOG_LEVEL_MESSAGE</code></a>. stdout is used for the rest.
664
621
<div class="variablelist"><table border="0">
665
622
<col align="left" valign="top">
668
<td><p><span class="term"><em class="parameter"><code>log_domain</code></em> :</span></p></td>
625
<td><p><span class="term"><em class="parameter"><code>log_domain</code></em> :</span></p></td>
669
626
<td>the log domain of the message.
673
<td><p><span class="term"><em class="parameter"><code>log_level</code></em> :</span></p></td>
630
<td><p><span class="term"><em class="parameter"><code>log_level</code></em> :</span></p></td>
674
631
<td>the level of the message.
678
<td><p><span class="term"><em class="parameter"><code>message</code></em> :</span></p></td>
635
<td><p><span class="term"><em class="parameter"><code>message</code></em> :</span></p></td>
683
<td><p><span class="term"><em class="parameter"><code>unused_data</code></em> :</span></p></td>
684
<td>data passed from <a class="link" href="glib-Message-Logging.html#g-log"><code class="function">g_log()</code></a> which is unused.
640
<td><p><span class="term"><em class="parameter"><code>unused_data</code></em> :</span></p></td>
641
<td>data passed from <a class="link" href="glib-Message-Logging.html#g-log" title="g_log ()"><code class="function">g_log()</code></a> which is unused.
693
648
<div class="refsect2" lang="en">
694
<a name="id3016185"></a><h3>
695
<a name="g-log-set-default-handler"></a>g_log_set_default_handler ()</h3>
696
<a class="indexterm" name="id3016201"></a><pre class="programlisting"><a class="link" href="glib-Message-Logging.html#GLogFunc">GLogFunc</a> g_log_set_default_handler (<a class="link" href="glib-Message-Logging.html#GLogFunc">GLogFunc</a> log_func,
697
<a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);</pre>
649
<a name="g-log-set-default-handler"></a><h3>g_log_set_default_handler ()</h3>
650
<pre class="programlisting"><a class="link" href="glib-Message-Logging.html#GLogFunc" title="GLogFunc ()">GLogFunc</a> g_log_set_default_handler (<a class="link" href="glib-Message-Logging.html#GLogFunc" title="GLogFunc ()">GLogFunc</a> log_func,
651
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer">gpointer</a> user_data);</pre>
699
Installs a default log handler which is used if no
653
Installs a default log handler which is used if no
700
654
log handler has been set for the particular log domain
701
and log level combination. By default, GLib uses
702
<a class="link" href="glib-Message-Logging.html#g-log-default-handler"><code class="function">g_log_default_handler()</code></a> as default log handler.
655
and log level combination. By default, GLib uses
656
<a class="link" href="glib-Message-Logging.html#g-log-default-handler" title="g_log_default_handler ()"><code class="function">g_log_default_handler()</code></a> as default log handler.
704
658
<div class="variablelist"><table border="0">
705
659
<col align="left" valign="top">
708
<td><p><span class="term"><em class="parameter"><code>log_func</code></em> :</span></p></td>
662
<td><p><span class="term"><em class="parameter"><code>log_func</code></em> :</span></p></td>
709
663
<td>the log handler function.
713
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
667
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
714
668
<td>data passed to the log handler.
718
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
672
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
719
673
<td>the previous default log handler
724
<p class="since">Since 2.6
730
<div class="refsect1" lang="en">
731
<a name="id3016303"></a><div class="refsect2" lang="en"><a name="id3016304"></a></div>
678
<p class="since">Since 2.6</p>
733
<div class="refsect2" lang="en"><a name="id3016305"></a></div>
684
Generated by GTK-Doc V1.11</div>