Daniel P. Berrange wrote:
How about this patch. I define VIR_DEBUG in src/internal.c. Each
module
which wants to output debug messages adds
#define DEBUG(fmt,...) VIR_DEBUG("driver", fmt, __VA_ARGS__)
#define DEBUG0(msg) VIR_DEBUG("driver", "%s", msg)
Changing 'driver' to whatever their module name wants to be. All log
messages get the function name included
+1, the patch looks fine to me.
If we want to take this further to allow apps to turn it on/off via
their
own 'debug' flag instead of an env variable, then we need a logging API
and a way for applications to register a callback to receive log messages.
I wouldn't bother making it too complicated.
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