[Libvir] PATCH 16/20: add a generic logging API

Richard W.M. Jones rjones at redhat.com
Fri Jun 22 14:01:38 UTC 2007

Daniel P. Berrange wrote:
> This patch adds a generic API for drivers to log warning / debug / info 
> messages. The existing error APIs are not suitable for this purpose since
> each time you set an error, it clears the previous one. This adds a public
> API virSetLogFunc allowing applications to register a callback to receive
> log messages. If none is registered, they are sent to the big void. It
> adapts the QEMU driver to use this logging API instead of qemudLog and
> qemudDebug(). It makes the qemud/qemud.c file register a logging callback
> to receive the messages & send them onto syslog/stderr as needed.
> There are other drivers (in particular src/xm_internal.c) where this
> logging API will be useful too. I've not attempted to make them use it
> yet though.

So to get this straight - this not intended to replace error messages, 
just informational messages?

You should allow more than one handler to be registered, and you should 
allow handlers to unregister themselves (give them a token which they 
can pass back to an unregister function).

Should the default be to print to stderr?  syslog? ...?


Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070622/6f6367e2/attachment-0001.bin>

More information about the libvir-list mailing list