daemon: Split filter parsing and filter defining

Similar to outputs, parser should do parsing only, thus the 'define' logic
is going to be stripped from virLogParseAndDefineFilters by replacing calls to
this method to virLogSetFilters instead.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
Erik Skultety 2016-03-29 16:48:08 +02:00
parent c9279169a1
commit 30b650b2ba
5 changed files with 7 additions and 6 deletions

View File

@ -691,7 +691,7 @@ daemonSetupLogging(struct daemonConfig *config,
virLogSetFromEnv();
if (virLogGetNbFilters() == 0)
virLogParseAndDefineFilters(config->log_filters);
virLogSetFilters(config->log_filters);
if (config->log_outputs && virLogGetNbOutputs() == 0)
virLogSetOutputs(config->log_outputs);

View File

@ -476,7 +476,7 @@ virLockDaemonSetupLogging(virLockDaemonConfigPtr config,
virLogSetFromEnv();
if (virLogGetNbFilters() == 0)
virLogParseAndDefineFilters(config->log_filters);
virLogSetFilters(config->log_filters);
if (config->log_outputs && virLogGetNbOutputs() == 0)
virLogSetOutputs(config->log_outputs);

View File

@ -404,7 +404,7 @@ virLogDaemonSetupLogging(virLogDaemonConfigPtr config,
virLogSetFromEnv();
if (virLogGetNbFilters() == 0)
virLogParseAndDefineFilters(config->log_filters);
virLogSetFilters(config->log_filters);
if (config->log_outputs && virLogGetNbOutputs() == 0)
virLogSetOutputs(config->log_outputs);

View File

@ -1624,7 +1624,7 @@ virLogSetFromEnv(void)
virLogParseDefaultPriority(debugEnv);
debugEnv = virGetEnvAllowSUID("LIBVIRT_LOG_FILTERS");
if (debugEnv && *debugEnv)
virLogParseAndDefineFilters(debugEnv);
virLogSetFilters(debugEnv);
debugEnv = virGetEnvAllowSUID("LIBVIRT_LOG_OUTPUTS");
if (debugEnv && *debugEnv)
virLogSetOutputs(debugEnv);

View File

@ -80,9 +80,10 @@ testLogParseFilters(const void *opaque)
{
int ret = -1;
int nfilters;
virLogFilterPtr *filters = NULL;
const struct testLogData *data = opaque;
nfilters = virLogParseAndDefineFilters(data->str);
nfilters = virLogParseFilters(data->str, &filters);
if (nfilters < 0) {
if (!data->pass) {
VIR_TEST_DEBUG("Got expected error: %s\n",
@ -102,7 +103,7 @@ testLogParseFilters(const void *opaque)
ret = 0;
cleanup:
virLogReset();
virLogFilterListFree(filters, nfilters);
return ret;
}