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? ...?
Rich.
--
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