summaryrefslogtreecommitdiff
path: root/ohmd/ohm-main.c
diff options
context:
space:
mode:
authorRob Taylor <rob.taylor@codethink.co.uk>2007-08-03 15:29:03 +0100
committerRob Taylor <rob.taylor@codethink.co.uk>2007-08-03 15:29:03 +0100
commit464338980e1acf745f76ab737951fa67a39d4e17 (patch)
tree9c0abcdf86a63ce980289f7b92e029c9b5218740 /ohmd/ohm-main.c
parent79de50a2d1666be3f63243b2b91c738f99c3271a (diff)
add command line options for --g-fatal-warnings and --g-fatal-critical
Gives ohmd two new command line options: --g-fatal-warnings that makes g_warnings fatal and exits, and --g-fatal-critical, which makes g_critical cause a fatal error. Updates run-ohm.sh to always run with --g-fatal-critical
Diffstat (limited to 'ohmd/ohm-main.c')
-rw-r--r--ohmd/ohm-main.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/ohmd/ohm-main.c b/ohmd/ohm-main.c
index 2a0d01d..c166008 100644
--- a/ohmd/ohm-main.c
+++ b/ohmd/ohm-main.c
@@ -111,6 +111,8 @@ main (int argc, char *argv[])
gboolean verbose = FALSE;
gboolean no_daemon = FALSE;
gboolean timed_exit = FALSE;
+ gboolean g_fatal_warnings = FALSE;
+ gboolean g_fatal_critical = FALSE;
OhmManager *manager = NULL;
GError *error = NULL;
GOptionContext *context;
@@ -122,6 +124,10 @@ main (int argc, char *argv[])
N_("Show extra debugging information"), NULL },
{ "timed-exit", '\0', 0, G_OPTION_ARG_NONE, &timed_exit,
N_("Exit after a small delay (for debugging)"), NULL },
+ { "g-fatal-warnings", 0, 0, G_OPTION_ARG_NONE, &g_fatal_warnings,
+ N_("Make all warnings fatal"), NULL },
+ { "g-fatal-critical", 0, 0, G_OPTION_ARG_NONE, &g_fatal_critical,
+ N_("Make all critical warnings fatal"), NULL },
{ NULL}
};
@@ -131,6 +137,16 @@ main (int argc, char *argv[])
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
g_option_context_parse (context, &argc, &argv, &error);
+ if (g_fatal_warnings || g_fatal_critical)
+ {
+ GLogLevelFlags fatal_mask;
+
+ g_debug("setting fatal warnings");
+ fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
+ fatal_mask |= (g_fatal_warnings?G_LOG_LEVEL_WARNING:0) | G_LOG_LEVEL_CRITICAL;
+ g_log_set_always_fatal (fatal_mask);
+ }
+
g_type_init ();
if (!g_thread_supported ())
g_thread_init (NULL);