[libvirt] [PATCH 2/7 v2] Refactor code that skips logging of error messages
Eric Blake
eblake at redhat.com
Mon Mar 17 17:10:57 UTC 2014
On 03/10/2014 09:01 AM, Daniel P. Berrange wrote:
> 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 at redhat.com>
> ---
> src/util/virerror.c | 17 +++++++++++++----
> src/util/virlog.c | 2 +-
> 2 files changed, 14 insertions(+), 5 deletions(-)
>
ACK
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140317/a4090f51/attachment-0001.sig>
More information about the libvir-list
mailing list