
On Wed, Jan 16, 2008 at 09:56:16AM +0000, Richard W.M. Jones wrote:
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.
+1 too
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.
This can probably be added later easilly, once we have the centralized function it's 'just' a matter of adding an extra debug switch in the API, if the need arose, we can cook this up quickly. Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/