int debug_level=0;
-int global_debug_level=0;
+#define GLOBAL_DEBUG_LEVEL_UNSET -1
+int global_debug_level=GLOBAL_DEBUG_LEVEL_UNSET;
int segv_level=0;
int timestamp_prefix=0;
}
void
+debug_set_global_level(int level, int override_old_value ) {
+ if (global_debug_level == GLOBAL_DEBUG_LEVEL_UNSET || override_old_value) {
+ global_debug_level=level;
+ if (debug_level < global_debug_level){
+ debug_level = global_debug_level;
+ }
+ }
+}
+
+void
debug_level_set(const char *name, int level)
{
if (!strcmp(name, "segv")) {
} else if (!strcmp(name, "timestamps")) {
timestamp_prefix=level;
} else if (!strcmp(name, DEBUG_MODULE_GLOBAL)) {
- global_debug_level=level;
- if (debug_level < global_debug_level){
- debug_level = global_debug_level;
- }
+ debug_set_global_level(level, 0);
} else {
g_hash_table_insert(debug_hash, g_strdup(name), GINT_TO_POINTER(level));
g_hash_table_foreach(debug_hash, debug_update_level, NULL);
<plugin path="$NAVIT_LIBDIR/*/${NAVIT_LIBPREFIX}libgraphics_null.so" active="no"/>
</plugins>
- <!-- The global debug level (like using command line option "-d"). -->
+ <!-- The global debug level (like using command line option "-d"). Ignored if option -d is used. -->
<debug name="global" level="0"/>
<!-- Example of setting the debug level for a single function. -->
<debug name="navit:do_draw" level="0"/>
static void
print_usage(void)
{
- printf(_("navit usage:\nnavit [options] [configfile]\n\t-c <file>: use <file> as config file\n\t-d <n>: set the global debug output level to <n> (0-3).\n\t-h: print this usage info and exit.\n\t-v: Print the version and exit.\n"));
+ printf(_("navit usage:\n"
+ "navit [options] [configfile]\n"
+ "\t-c <file>: use <file> as config file\n"
+ "\t-d <n>: set the global debug output level to <n> (0-3). Overrides setting from config file.\n"
+ "\t-h: print this usage info and exit.\n"
+ "\t-v: Print the version and exit.\n"));
}
if (argc == 2 && !strcmp(argv[1],"-RegisterForSystemEvents"))
argc=1;
if (argc > 1) {
- /* DEVELOPPERS : don't forget to update the manpage if you modify theses options */
+ /* Don't forget to update the manpage if you modify theses options */
while((opt = getopt(argc, argv, ":hvc:d:e:s:")) != -1) {
switch(opt) {
case 'h':
config_file = optarg;
break;
case 'd':
- debug_level_set(DEBUG_MODULE_GLOBAL, atoi(optarg));
+ debug_set_global_level(atoi(optarg), 1);
break;
case 'e':
command=optarg;