__attribute__((cleanup(log_config_free))) struct log_config config = {NULL, NULL};
const int r = log_config_read_file(&config, inotify_path);
- if (r) {
+ if (r && r != -ENOENT) {
syslog_critical_failure("DLog: keeping current runtime filters, can't read from \"%s\" (%d)", inotify_path, -r);// LCOV_EXCL_LINE
return;
}
bool limiter;
bool dynamic_config;
bool plog[LOG_ID_MAX];
+bool plog_default_values[LOG_ID_MAX];
void __update_plog(const struct log_config *conf);
return 1;
}
-static void __configure_parameters(struct log_config *config)
+static void __set_plog_default_values()
+{
+ for (int i = 0; i < NELEMS(plog); ++i)
+ plog_default_values[i] = plog[i];
+}
+
+static void __initialize_plog(const struct log_config *config)
{
assert(config);
for (int i = 0; i < NELEMS(plog); ++i)
plog[i] = plog_default;
plog[LOG_ID_APPS] = true; // the default does not apply here for backward compatibility reasons.
+ __set_plog_default_values();
+}
+
+static void __configure_parameters(struct log_config *config)
+{
+ assert(config);
+
+ __initialize_plog(config);
__update_plog(config);
+ __set_plog_default_values();
debugmode = log_config_get_int(config, "debugmode", DEFAULT_CONFIG_DEBUGMODE);
fatal_assert = access(DEBUGMODE_FILE, F_OK) != -1;
const int r = snprintf(key, sizeof key, "enable_%s", log_name_by_id((log_id_t)i));
if (r < 0)
continue;
- plog[i] = log_config_get_boolean(conf, key, plog[i]);
+ plog[i] = log_config_get_boolean(conf, key, plog_default_values[i]);
}
}