]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commit
Refactor code that skips logging of error messages
authorDaniel P. Berrange <berrange@redhat.com>
Mon, 3 Mar 2014 18:29:33 +0000 (18:29 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 18 Mar 2014 14:29:21 +0000 (14:29 +0000)
commit3887c5d83b940a04ae4a0c9690244711238f1f51
treea45b402ade8cc4c98f30c529b63cb922fd603c47
parent27f2edf96c1fca1aafaff416e9a44bd962c4cbc4
Refactor code that skips logging of error messages

The error reporting code will invoke a callback when any error
is raised and the default callback will print to stderr. The
virRaiseErrorFull method also sends all error messages on to the
logging code, which also prints to stderr by default. To avoid
duplicated data on stderr, the logging code has some logic to
skip emission when no log outputs are configured, which checks
whether the virLogSource == VIR_LOG_FROM_ERROR.

Meanwhile the libvirtd daemon can register another callback which
is used to reduce log message priority from error to a lower level.
When this is used we do want messages to end up on stderr, so the
error code will conditionally use either VIR_LOG_FROM_FILE or
VIR_LOG_FROM_ERROR depending on whether such a callback is provided.

This will all complicate later refactoring. By pushing the checks
for whether a log output is present up a level into the error code,
the special cases can be isolated in one place.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/util/virerror.c
src/util/virlog.c