</tp:docstring>
<arg name="level" type="s" direction="in">
<tp:docstring>
- One of [ERR, WARN, INFO, DEBUG, TRACE].
+ One of [ERR, WARN, INFO, DEBUG, TRACE, OFF, KEEP].
+ This level is applied to the domains as specified in the domains
+ argument. Except for the special level "KEEP", all unmentioned
+ domains are disabled entirely. "KEEP" is special and allows
+ not to change the current setting except for the specified
+ domains. E.g. level=KEEP and domains=PLATFORM:DEBUG will only
+ touch the platform domain.
</tp:docstring>
</arg>
<arg name="domains" type="s" direction="in">
[LOGL_WARN] = { "WARN", "<warn>", LOG_WARNING, G_LOG_LEVEL_WARNING, FALSE },
[LOGL_ERR] = { "ERR", "<error>", LOG_ERR, G_LOG_LEVEL_WARNING, TRUE },
[_LOGL_OFF] = { "OFF", NULL, 0, 0, FALSE },
+ [_LOGL_KEEP] = { "KEEP", NULL, 0, 0, FALSE },
};
static const LogDesc domain_descs[] = {
if (level && *level) {
if (!match_log_level (level, &new_log_level, error))
return FALSE;
+ if (new_log_level == _LOGL_KEEP) {
+ new_log_level = log_level;
+ for (i = 0; i < G_N_ELEMENTS (new_logging); i++)
+ new_logging[i] = logging[i];
+ }
}
/* domains */
}
}
- for (i = 0; i < G_N_ELEMENTS (new_logging); i++) {
- if (i < domain_log_level)
- new_logging[i] &= ~bits;
- else
- new_logging[i] |= bits;
+ if (domain_log_level == _LOGL_KEEP) {
+ for (i = 0; i < G_N_ELEMENTS (new_logging); i++)
+ new_logging[i] = (new_logging[i] & ~bits) | (logging[i] & bits);
+ } else {
+ for (i = 0; i < G_N_ELEMENTS (new_logging); i++) {
+ if (i < domain_log_level)
+ new_logging[i] &= ~bits;
+ else
+ new_logging[i] |= bits;
+ }
}
}
g_strfreev (tmp);
_LOGL_N_REAL, /* the number of actual logging levels */
_LOGL_OFF = _LOGL_N_REAL, /* special logging level that is always disabled. */
+ _LOGL_KEEP, /* special logging level to indicate that the logging level should not be changed. */
_LOGL_N, /* the number of logging levels including "OFF" */
} NMLogLevel;