1 /* GLIB - Library of useful routines for C programming
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * Modified by the GLib Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GLib Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GLib at ftp://ftp.gtk.org/pub/gtk/.
46 #include "gprintfint.h"
47 #include "gthreadprivate.h"
51 #include <process.h> /* For getpid() */
53 # define STRICT /* Strict typing, please */
54 # define _WIN32_WINDOWS 0x0401 /* to get IsDebuggerPresent */
59 /* --- structures --- */
60 typedef struct _GLogDomain GLogDomain;
61 typedef struct _GLogHandler GLogHandler;
65 GLogLevelFlags fatal_mask;
66 GLogHandler *handlers;
72 GLogLevelFlags log_level;
79 /* --- variables --- */
80 static GMutex *g_messages_lock = NULL;
81 static GLogDomain *g_log_domains = NULL;
82 static GLogLevelFlags g_log_always_fatal = G_LOG_FATAL_MASK;
83 static GPrintFunc glib_print_func = NULL;
84 static GPrintFunc glib_printerr_func = NULL;
85 static GPrivate *g_log_depth = NULL;
86 static GLogLevelFlags g_log_msg_prefix = G_LOG_LEVEL_ERROR | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_DEBUG;
87 static GLogFunc default_log_func = g_log_default_handler;
88 static gpointer default_log_data = NULL;
89 static GTestLogFatalFunc fatal_log_func = NULL;
90 static gpointer fatal_log_data;
92 /* --- functions --- */
97 static gboolean win32_keep_fatal_message = FALSE;
99 /* This default message will usually be overwritten. */
100 /* Yes, a fixed size buffer is bad. So sue me. But g_error() is never
101 * called with huge strings, is it?
103 static gchar fatal_msg_buf[1000] = "Unspecified fatal error encountered, aborting.";
104 static gchar *fatal_msg_ptr = fatal_msg_buf;
112 if (win32_keep_fatal_message)
114 memcpy (fatal_msg_ptr, buf, len);
115 fatal_msg_ptr += len;
120 write (fd, buf, len);
124 #define write(fd, buf, len) dowrite(fd, buf, len)
129 write_string (int fd,
132 write (fd, string, strlen (string));
136 g_messages_prefixed_init (void)
138 static gboolean initialized = FALSE;
145 val = g_getenv ("G_MESSAGES_PREFIXED");
149 const GDebugKey keys[] = {
150 { "error", G_LOG_LEVEL_ERROR },
151 { "critical", G_LOG_LEVEL_CRITICAL },
152 { "warning", G_LOG_LEVEL_WARNING },
153 { "message", G_LOG_LEVEL_MESSAGE },
154 { "info", G_LOG_LEVEL_INFO },
155 { "debug", G_LOG_LEVEL_DEBUG }
158 g_log_msg_prefix = g_parse_debug_string (val, keys, G_N_ELEMENTS (keys));
164 g_log_find_domain_L (const gchar *log_domain)
166 register GLogDomain *domain;
168 domain = g_log_domains;
171 if (strcmp (domain->log_domain, log_domain) == 0)
173 domain = domain->next;
179 g_log_domain_new_L (const gchar *log_domain)
181 register GLogDomain *domain;
183 domain = g_new (GLogDomain, 1);
184 domain->log_domain = g_strdup (log_domain);
185 domain->fatal_mask = G_LOG_FATAL_MASK;
186 domain->handlers = NULL;
188 domain->next = g_log_domains;
189 g_log_domains = domain;
195 g_log_domain_check_free_L (GLogDomain *domain)
197 if (domain->fatal_mask == G_LOG_FATAL_MASK &&
198 domain->handlers == NULL)
200 register GLogDomain *last, *work;
204 work = g_log_domains;
210 last->next = domain->next;
212 g_log_domains = domain->next;
213 g_free (domain->log_domain);
224 g_log_domain_get_handler_L (GLogDomain *domain,
225 GLogLevelFlags log_level,
228 if (domain && log_level)
230 register GLogHandler *handler;
232 handler = domain->handlers;
235 if ((handler->log_level & log_level) == log_level)
237 *data = handler->data;
238 return handler->log_func;
240 handler = handler->next;
244 *data = default_log_data;
245 return default_log_func;
249 g_log_set_always_fatal (GLogLevelFlags fatal_mask)
251 GLogLevelFlags old_mask;
253 /* restrict the global mask to levels that are known to glib
254 * since this setting applies to all domains
256 fatal_mask &= (1 << G_LOG_LEVEL_USER_SHIFT) - 1;
257 /* force errors to be fatal */
258 fatal_mask |= G_LOG_LEVEL_ERROR;
259 /* remove bogus flag */
260 fatal_mask &= ~G_LOG_FLAG_FATAL;
262 g_mutex_lock (g_messages_lock);
263 old_mask = g_log_always_fatal;
264 g_log_always_fatal = fatal_mask;
265 g_mutex_unlock (g_messages_lock);
271 g_log_set_fatal_mask (const gchar *log_domain,
272 GLogLevelFlags fatal_mask)
274 GLogLevelFlags old_flags;
275 register GLogDomain *domain;
280 /* force errors to be fatal */
281 fatal_mask |= G_LOG_LEVEL_ERROR;
282 /* remove bogus flag */
283 fatal_mask &= ~G_LOG_FLAG_FATAL;
285 g_mutex_lock (g_messages_lock);
287 domain = g_log_find_domain_L (log_domain);
289 domain = g_log_domain_new_L (log_domain);
290 old_flags = domain->fatal_mask;
292 domain->fatal_mask = fatal_mask;
293 g_log_domain_check_free_L (domain);
295 g_mutex_unlock (g_messages_lock);
301 g_log_set_handler (const gchar *log_domain,
302 GLogLevelFlags log_levels,
306 static guint handler_id = 0;
308 GLogHandler *handler;
310 g_return_val_if_fail ((log_levels & G_LOG_LEVEL_MASK) != 0, 0);
311 g_return_val_if_fail (log_func != NULL, 0);
316 handler = g_new (GLogHandler, 1);
318 g_mutex_lock (g_messages_lock);
320 domain = g_log_find_domain_L (log_domain);
322 domain = g_log_domain_new_L (log_domain);
324 handler->id = ++handler_id;
325 handler->log_level = log_levels;
326 handler->log_func = log_func;
327 handler->data = user_data;
328 handler->next = domain->handlers;
329 domain->handlers = handler;
331 g_mutex_unlock (g_messages_lock);
337 g_log_set_default_handler (GLogFunc log_func,
340 GLogFunc old_log_func;
342 g_mutex_lock (g_messages_lock);
343 old_log_func = default_log_func;
344 default_log_func = log_func;
345 default_log_data = user_data;
346 g_mutex_unlock (g_messages_lock);
352 * g_test_log_set_fatal_handler:
353 * @log_func: the log handler function.
354 * @user_data: data passed to the log handler.
356 * Installs a non-error fatal log handler which can be
357 * used to decide whether log messages which are counted
358 * as fatal abort the program.
360 * The use case here is that you are running a test case
361 * that depends on particular libraries or circumstances
362 * and cannot prevent certain known critical or warning
363 * messages. So you install a handler that compares the
364 * domain and message to precisely not abort in such a case.
366 * Note that the handler is reset at the beginning of
367 * any test case, so you have to set it inside each test
368 * function which needs the special behavior.
370 * This handler has no effect on g_error messages.
375 g_test_log_set_fatal_handler (GTestLogFatalFunc log_func,
378 g_mutex_lock (g_messages_lock);
379 fatal_log_func = log_func;
380 fatal_log_data = user_data;
381 g_mutex_unlock (g_messages_lock);
385 g_log_remove_handler (const gchar *log_domain,
388 register GLogDomain *domain;
390 g_return_if_fail (handler_id > 0);
395 g_mutex_lock (g_messages_lock);
396 domain = g_log_find_domain_L (log_domain);
399 GLogHandler *work, *last;
402 work = domain->handlers;
405 if (work->id == handler_id)
408 last->next = work->next;
410 domain->handlers = work->next;
411 g_log_domain_check_free_L (domain);
412 g_mutex_unlock (g_messages_lock);
420 g_mutex_unlock (g_messages_lock);
421 g_warning ("%s: could not find handler with id `%d' for domain \"%s\"",
422 G_STRLOC, handler_id, log_domain);
426 g_logv (const gchar *log_domain,
427 GLogLevelFlags log_level,
431 gboolean was_fatal = (log_level & G_LOG_FLAG_FATAL) != 0;
432 gboolean was_recursion = (log_level & G_LOG_FLAG_RECURSION) != 0;
435 log_level &= G_LOG_LEVEL_MASK;
439 for (i = g_bit_nth_msf (log_level, -1); i >= 0; i = g_bit_nth_msf (log_level, i))
441 register GLogLevelFlags test_level;
444 if (log_level & test_level)
446 guint depth = GPOINTER_TO_UINT (g_private_get (g_log_depth));
449 GLogLevelFlags domain_fatal_mask;
450 gpointer data = NULL;
453 test_level |= G_LOG_FLAG_FATAL;
455 test_level |= G_LOG_FLAG_RECURSION;
457 /* check recursion and lookup handler */
458 g_mutex_lock (g_messages_lock);
459 domain = g_log_find_domain_L (log_domain ? log_domain : "");
461 test_level |= G_LOG_FLAG_RECURSION;
463 domain_fatal_mask = domain ? domain->fatal_mask : G_LOG_FATAL_MASK;
464 if ((domain_fatal_mask | g_log_always_fatal) & test_level)
465 test_level |= G_LOG_FLAG_FATAL;
466 if (test_level & G_LOG_FLAG_RECURSION)
467 log_func = _g_log_fallback_handler;
469 log_func = g_log_domain_get_handler_L (domain, test_level, &data);
471 g_mutex_unlock (g_messages_lock);
473 g_private_set (g_log_depth, GUINT_TO_POINTER (depth));
475 /* had to defer debug initialization until we can keep track of recursion */
476 if (!(test_level & G_LOG_FLAG_RECURSION) && !_g_debug_initialized)
478 GLogLevelFlags orig_test_level = test_level;
481 if ((domain_fatal_mask | g_log_always_fatal) & test_level)
482 test_level |= G_LOG_FLAG_FATAL;
483 if (test_level != orig_test_level)
485 /* need a relookup, not nice, but not too bad either */
486 g_mutex_lock (g_messages_lock);
487 domain = g_log_find_domain_L (log_domain ? log_domain : "");
488 log_func = g_log_domain_get_handler_L (domain, test_level, &data);
490 g_mutex_unlock (g_messages_lock);
494 gboolean masquerade_fatal = FALSE;
495 if (test_level & G_LOG_FLAG_RECURSION)
497 /* we use a stack buffer of fixed size, since we're likely
498 * in an out-of-memory situation
504 G_VA_COPY (args2, args1);
505 size = _g_vsnprintf (buffer, 1024, format, args2);
508 log_func (log_domain, test_level, buffer, data);
515 G_VA_COPY (args2, args1);
516 msg = g_strdup_vprintf (format, args2);
519 log_func (log_domain, test_level, msg, data);
521 if ((test_level & G_LOG_FLAG_FATAL)
522 && !(test_level & G_LOG_LEVEL_ERROR))
524 masquerade_fatal = fatal_log_func
525 && !fatal_log_func (log_domain, test_level, msg, data);
531 if ((test_level & G_LOG_FLAG_FATAL) && !masquerade_fatal)
534 gchar *locale_msg = g_locale_from_utf8 (fatal_msg_buf, -1, NULL, NULL, NULL);
536 MessageBox (NULL, locale_msg, NULL,
537 MB_ICONERROR|MB_SETFOREGROUND);
538 if (IsDebuggerPresent () && !(test_level & G_LOG_FLAG_RECURSION))
543 #if defined (G_ENABLE_DEBUG) && defined (SIGTRAP)
544 if (!(test_level & G_LOG_FLAG_RECURSION))
548 #else /* !G_ENABLE_DEBUG || !SIGTRAP */
550 #endif /* !G_ENABLE_DEBUG || !SIGTRAP */
551 #endif /* !G_OS_WIN32 */
555 g_private_set (g_log_depth, GUINT_TO_POINTER (depth));
561 g_log (const gchar *log_domain,
562 GLogLevelFlags log_level,
568 va_start (args, format);
569 g_logv (log_domain, log_level, format, args);
574 g_return_if_fail_warning (const char *log_domain,
575 const char *pretty_function,
576 const char *expression)
579 * Omit the prefix used by the PLT-reduction
580 * technique used in GTK+.
582 if (g_str_has_prefix (pretty_function, "IA__"))
583 pretty_function += 4;
585 G_LOG_LEVEL_CRITICAL,
586 "%s: assertion `%s' failed",
592 g_warn_message (const char *domain,
596 const char *warnexpr)
599 g_snprintf (lstr, 32, "%d", line);
601 s = g_strconcat ("(", file, ":", lstr, "):",
602 func, func[0] ? ":" : "",
603 " runtime check failed: (", warnexpr, ")", NULL);
605 s = g_strconcat ("(", file, ":", lstr, "):",
606 func, func[0] ? ":" : "",
607 " ", "code should not be reached", NULL);
608 g_log (domain, G_LOG_LEVEL_WARNING, "%s", s);
613 g_assert_warning (const char *log_domain,
616 const char *pretty_function,
617 const char *expression)
620 * Omit the prefix used by the PLT-reduction
621 * technique used in GTK+.
623 if (g_str_has_prefix (pretty_function, "IA__"))
624 pretty_function += 4;
628 ? "file %s: line %d (%s): assertion failed: (%s)"
629 : "file %s: line %d (%s): should not be reached",
637 #define CHAR_IS_SAFE(wc) (!((wc < 0x20 && wc != '\t' && wc != '\n' && wc != '\r') || \
639 (wc >= 0x80 && wc < 0xa0)))
642 strdup_convert (const gchar *string,
643 const gchar *charset)
645 if (!g_utf8_validate (string, -1, NULL))
647 GString *gstring = g_string_new ("[Invalid UTF-8] ");
650 for (p = (guchar *)string; *p; p++)
652 if (CHAR_IS_SAFE(*p) &&
653 !(*p == '\r' && *(p + 1) != '\n') &&
655 g_string_append_c (gstring, *p);
657 g_string_append_printf (gstring, "\\x%02x", (guint)(guchar)*p);
660 return g_string_free (gstring, FALSE);
666 gchar *result = g_convert_with_fallback (string, -1, charset, "UTF-8", "?", NULL, NULL, &err);
671 /* Not thread-safe, but doesn't matter if we print the warning twice
673 static gboolean warned = FALSE;
677 _g_fprintf (stderr, "GLib: Cannot convert message: %s\n", err->message);
681 return g_strdup (string);
686 /* For a radix of 8 we need at most 3 output bytes for 1 input
687 * byte. Additionally we might need up to 2 output bytes for the
688 * readix prefix and 1 byte for the trailing NULL.
690 #define FORMAT_UNSIGNED_BUFSIZE ((GLIB_SIZEOF_LONG * 3) + 3)
693 format_unsigned (gchar *buf,
701 /* we may not call _any_ GLib functions here (or macros like g_return_if_fail()) */
703 if (radix != 8 && radix != 10 && radix != 16)
736 /* Again we can't use g_assert; actually this check should _never_ fail. */
737 if (n > FORMAT_UNSIGNED_BUFSIZE - 3)
750 buf[i] = c + 'a' - 10;
757 /* string size big enough to hold level prefix */
758 #define STRING_BUFFER_SIZE (FORMAT_UNSIGNED_BUFSIZE + 32)
760 #define ALERT_LEVELS (G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING)
763 mklevel_prefix (gchar level_prefix[STRING_BUFFER_SIZE],
764 GLogLevelFlags log_level)
766 gboolean to_stdout = TRUE;
768 /* we may not call _any_ GLib functions here */
770 switch (log_level & G_LOG_LEVEL_MASK)
772 case G_LOG_LEVEL_ERROR:
773 strcpy (level_prefix, "ERROR");
776 case G_LOG_LEVEL_CRITICAL:
777 strcpy (level_prefix, "CRITICAL");
780 case G_LOG_LEVEL_WARNING:
781 strcpy (level_prefix, "WARNING");
784 case G_LOG_LEVEL_MESSAGE:
785 strcpy (level_prefix, "Message");
788 case G_LOG_LEVEL_INFO:
789 strcpy (level_prefix, "INFO");
791 case G_LOG_LEVEL_DEBUG:
792 strcpy (level_prefix, "DEBUG");
797 strcpy (level_prefix, "LOG-");
798 format_unsigned (level_prefix + 4, log_level & G_LOG_LEVEL_MASK, 16);
801 strcpy (level_prefix, "LOG");
804 if (log_level & G_LOG_FLAG_RECURSION)
805 strcat (level_prefix, " (recursed)");
806 if (log_level & ALERT_LEVELS)
807 strcat (level_prefix, " **");
810 win32_keep_fatal_message = (log_level & G_LOG_FLAG_FATAL) != 0;
812 return to_stdout ? 1 : 2;
816 _g_log_fallback_handler (const gchar *log_domain,
817 GLogLevelFlags log_level,
818 const gchar *message,
819 gpointer unused_data)
821 gchar level_prefix[STRING_BUFFER_SIZE];
823 gchar pid_string[FORMAT_UNSIGNED_BUFSIZE];
825 gboolean is_fatal = (log_level & G_LOG_FLAG_FATAL) != 0;
828 /* we can not call _any_ GLib functions in this fallback handler,
829 * which is why we skip UTF-8 conversion, etc.
830 * since we either recursed or ran out of memory, we're in a pretty
831 * pathologic situation anyways, what we can do is giving the
832 * the process ID unconditionally however.
835 fd = mklevel_prefix (level_prefix, log_level);
837 message = "(NULL) message";
840 format_unsigned (pid_string, getpid (), 10);
844 write_string (fd, "\n");
846 write_string (fd, "\n** ");
849 write_string (fd, "(process:");
850 write_string (fd, pid_string);
851 write_string (fd, "): ");
856 write_string (fd, log_domain);
857 write_string (fd, "-");
859 write_string (fd, level_prefix);
860 write_string (fd, ": ");
861 write_string (fd, message);
863 write_string (fd, "\naborting...\n");
865 write_string (fd, "\n");
869 escape_string (GString *string)
871 const char *p = string->str;
874 while (p < string->str + string->len)
878 wc = g_utf8_get_char_validated (p, -1);
879 if (wc == (gunichar)-1 || wc == (gunichar)-2)
884 pos = p - string->str;
886 /* Emit invalid UTF-8 as hex escapes
888 tmp = g_strdup_printf ("\\x%02x", (guint)(guchar)*p);
889 g_string_erase (string, pos, 1);
890 g_string_insert (string, pos, tmp);
892 p = string->str + (pos + 4); /* Skip over escape sequence */
899 safe = *(p + 1) == '\n';
903 safe = CHAR_IS_SAFE (wc);
911 pos = p - string->str;
913 /* Largest char we escape is 0x0a, so we don't have to worry
914 * about 8-digit \Uxxxxyyyy
916 tmp = g_strdup_printf ("\\u%04x", wc);
917 g_string_erase (string, pos, g_utf8_next_char (p) - p);
918 g_string_insert (string, pos, tmp);
921 p = string->str + (pos + 6); /* Skip over escape sequence */
924 p = g_utf8_next_char (p);
929 g_log_default_handler (const gchar *log_domain,
930 GLogLevelFlags log_level,
931 const gchar *message,
932 gpointer unused_data)
934 gboolean is_fatal = (log_level & G_LOG_FLAG_FATAL) != 0;
935 gchar level_prefix[STRING_BUFFER_SIZE], *string;
939 /* we can be called externally with recursion for whatever reason */
940 if (log_level & G_LOG_FLAG_RECURSION)
942 _g_log_fallback_handler (log_domain, log_level, message, unused_data);
946 g_messages_prefixed_init ();
948 fd = mklevel_prefix (level_prefix, log_level);
950 gstring = g_string_new (NULL);
951 if (log_level & ALERT_LEVELS)
952 g_string_append (gstring, "\n");
954 g_string_append (gstring, "** ");
956 if ((g_log_msg_prefix & log_level) == log_level)
958 const gchar *prg_name = g_get_prgname ();
961 g_string_append_printf (gstring, "(process:%lu): ", (gulong)getpid ());
963 g_string_append_printf (gstring, "(%s:%lu): ", prg_name, (gulong)getpid ());
968 g_string_append (gstring, log_domain);
969 g_string_append_c (gstring, '-');
971 g_string_append (gstring, level_prefix);
973 g_string_append (gstring, ": ");
975 g_string_append (gstring, "(NULL) message");
979 const gchar *charset;
981 msg = g_string_new (message);
984 if (g_get_charset (&charset))
985 g_string_append (gstring, msg->str); /* charset is UTF-8 already */
988 string = strdup_convert (msg->str, charset);
989 g_string_append (gstring, string);
993 g_string_free (msg, TRUE);
996 g_string_append (gstring, "\naborting...\n");
998 g_string_append (gstring, "\n");
1000 string = g_string_free (gstring, FALSE);
1002 write_string (fd, string);
1007 g_set_print_handler (GPrintFunc func)
1009 GPrintFunc old_print_func;
1011 g_mutex_lock (g_messages_lock);
1012 old_print_func = glib_print_func;
1013 glib_print_func = func;
1014 g_mutex_unlock (g_messages_lock);
1016 return old_print_func;
1020 g_print (const gchar *format,
1025 GPrintFunc local_glib_print_func;
1027 g_return_if_fail (format != NULL);
1029 va_start (args, format);
1030 string = g_strdup_vprintf (format, args);
1033 g_mutex_lock (g_messages_lock);
1034 local_glib_print_func = glib_print_func;
1035 g_mutex_unlock (g_messages_lock);
1037 if (local_glib_print_func)
1038 local_glib_print_func (string);
1041 const gchar *charset;
1043 if (g_get_charset (&charset))
1044 fputs (string, stdout); /* charset is UTF-8 already */
1047 gchar *lstring = strdup_convert (string, charset);
1049 fputs (lstring, stdout);
1058 g_set_printerr_handler (GPrintFunc func)
1060 GPrintFunc old_printerr_func;
1062 g_mutex_lock (g_messages_lock);
1063 old_printerr_func = glib_printerr_func;
1064 glib_printerr_func = func;
1065 g_mutex_unlock (g_messages_lock);
1067 return old_printerr_func;
1071 g_printerr (const gchar *format,
1076 GPrintFunc local_glib_printerr_func;
1078 g_return_if_fail (format != NULL);
1080 va_start (args, format);
1081 string = g_strdup_vprintf (format, args);
1084 g_mutex_lock (g_messages_lock);
1085 local_glib_printerr_func = glib_printerr_func;
1086 g_mutex_unlock (g_messages_lock);
1088 if (local_glib_printerr_func)
1089 local_glib_printerr_func (string);
1092 const gchar *charset;
1094 if (g_get_charset (&charset))
1095 fputs (string, stderr); /* charset is UTF-8 already */
1098 gchar *lstring = strdup_convert (string, charset);
1100 fputs (lstring, stderr);
1109 g_printf_string_upper_bound (const gchar *format,
1113 return _g_vsnprintf (&c, 1, format, args) + 1;
1117 _g_messages_thread_init_nomessage (void)
1119 g_messages_lock = g_mutex_new ();
1120 g_log_depth = g_private_new (NULL);
1121 g_messages_prefixed_init ();
1125 gboolean _g_debug_initialized = FALSE;
1126 guint _g_debug_flags = 0;
1129 _g_debug_init (void)
1133 _g_debug_initialized = TRUE;
1135 val = g_getenv ("G_DEBUG");
1138 const GDebugKey keys[] = {
1139 {"fatal_warnings", G_DEBUG_FATAL_WARNINGS},
1140 {"fatal_criticals", G_DEBUG_FATAL_CRITICALS}
1143 _g_debug_flags = g_parse_debug_string (val, keys, G_N_ELEMENTS (keys));
1146 if (_g_debug_flags & G_DEBUG_FATAL_WARNINGS)
1148 GLogLevelFlags fatal_mask;
1150 fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
1151 fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
1152 g_log_set_always_fatal (fatal_mask);
1155 if (_g_debug_flags & G_DEBUG_FATAL_CRITICALS)
1157 GLogLevelFlags fatal_mask;
1159 fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
1160 fatal_mask |= G_LOG_LEVEL_CRITICAL;
1161 g_log_set_always_fatal (fatal_mask);
1165 #define __G_MESSAGES_C__
1166 #include "galiasdef.c"