]> xenbits.xensource.com Git - libvirt.git/commitdiff
add new logging module, and move existing definitions there
authorDaniel Veillard <veillard@redhat.com>
Thu, 6 Nov 2008 16:36:07 +0000 (16:36 +0000)
committerDaniel Veillard <veillard@redhat.com>
Thu, 6 Nov 2008 16:36:07 +0000 (16:36 +0000)
* src/logging.c src/logging.h proxy/Makefile.am proxy/libvirt_proxy.c
  src/Makefile.am src/cgroup.c src/datatypes.c src/domain_event.c
  src/internal.h src/libvirt.c src/lxc_container.c src/lxc_controller.c
  src/lxc_driver.c src/proxy_internal.c src/qemu_driver.c
  src/remote_internal.c src/storage_backend_disk.c src/util.c
  src/veth.c src/xen_internal.c src/xen_unified.c src/xend_internal.c:
  add new logging module, and move existing definitions there
Daniel

23 files changed:
ChangeLog
proxy/Makefile.am
proxy/libvirt_proxy.c
src/Makefile.am
src/cgroup.c
src/datatypes.c
src/domain_event.c
src/internal.h
src/libvirt.c
src/logging.c [new file with mode: 0644]
src/logging.h [new file with mode: 0644]
src/lxc_container.c
src/lxc_controller.c
src/lxc_driver.c
src/proxy_internal.c
src/qemu_driver.c
src/remote_internal.c
src/storage_backend_disk.c
src/util.c
src/veth.c
src/xen_internal.c
src/xen_unified.c
src/xend_internal.c

index 18f2366f50b2808000ae45b20904326040560665..3449df768e865447f465fdff4187eca79b9a3748 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Thu Nov  6 17:33:34 CET 2008 Daniel Veillard <veillard@redhat.com>
+
+       * src/logging.c src/logging.h proxy/Makefile.am proxy/libvirt_proxy.c
+         src/Makefile.am src/cgroup.c src/datatypes.c src/domain_event.c
+         src/internal.h src/libvirt.c src/lxc_container.c src/lxc_controller.c
+         src/lxc_driver.c src/proxy_internal.c src/qemu_driver.c
+         src/remote_internal.c src/storage_backend_disk.c src/util.c
+         src/veth.c src/xen_internal.c src/xen_unified.c src/xend_internal.c:
+         add new logging module, and move existing definitions there
+
 Wed Nov  5 13:56:00 EST 2008 Cole Robinson <crobinso@redhat.com>
 
        * src/util.c: Log stdout and stderr in virRun
index 8a1f51c2bde2213bee7ca89f78695d5931f2783b..b680a1b306eb7d9578ba1f6c7bd1bfc084dcd286 100644 (file)
@@ -18,7 +18,8 @@ libvirt_proxy_SOURCES = libvirt_proxy.c @top_srcdir@/src/xend_internal.c \
             @top_srcdir@/src/domain_conf.c \
             @top_srcdir@/src/util.c \
            @top_srcdir@/src/event.c \
-           @top_srcdir@/src/uuid.c
+           @top_srcdir@/src/uuid.c \
+           @top_srcdir@/src/logging.c
 libvirt_proxy_LDFLAGS = $(WARN_CFLAGS) $(XEN_LIBS)
 libvirt_proxy_DEPENDENCIES =
 libvirt_proxy_LDADD = ../gnulib/lib/libgnu.la
index f072e5dbf36000705a8ea6b237c1dc9eefc088ce..b9de42534d31c764ddd17cd54b03982a3ca7ddaf 100644 (file)
 #include "xs_internal.h"
 #include "xen_unified.h"
 
-/*
- * This is provided in libvirt.c when the code is part of the library
- */
-int debugFlag = 0;
-
 static int fdServer = -1;
 static int debug = 0;
 static int persist = 0;
index 4779a22d848652d863c984a018d5f1a542f0d184..9b9520eaf25d6117407e8e0527d772c5a3eb3bf6 100644 (file)
@@ -52,6 +52,7 @@ GENERIC_LIB_SOURCES =                                         \
                uuid.c uuid.h                                   \
                util.c util.h                                   \
                virterror.c virterror_internal.h                \
+               logging.c logging.h                             \
                xml.c xml.h
 
 # Domain driver generic impl APIs
index f70bee27c69c5eef8a1720f08d5e616c0e20aeb5..be4cb12ca5e4c609642eafddeb7e69a82527da8d 100644 (file)
@@ -27,9 +27,7 @@
 #include "util.h"
 #include "memory.h"
 #include "cgroup.h"
-
-#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt, __VA_ARGS__)
-#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)
+#include "logging.h"
 
 #define CGROUP_MAX_VAL 512
 
index d351721fe16a943f16fb2b06a939add657573b13..c5054ed2bec3db84c9c242628a0115f9467e8690 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "datatypes.h"
 #include "virterror_internal.h"
+#include "logging.h"
 #include "memory.h"
 
 /************************************************************************
index a84fa74410b6830f77be7b0e1e7887f5a8e0b040..a74ae5dd05f3c250260f2cd7e2b919817ad916b7 100644 (file)
@@ -23,6 +23,7 @@
 #include <config.h>
 
 #include "domain_event.h"
+#include "logging.h"
 #include "datatypes.h"
 #include "memory.h"
 
index 926594f48ce5bc37efcfbe88fee73fd6672f5e0b..f0c3d7dd1346197fbddb2688043c7463b741155d 100644 (file)
 #define NUL_TERMINATE(buf) do { (buf)[sizeof(buf)-1] = '\0'; } while (0)
 #define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
 
-/* If configured with --enable-debug=yes then library calls
- * are printed to stderr for debugging.
- */
-#ifdef ENABLE_DEBUG
-extern int debugFlag;
-#define VIR_DEBUG(category, fmt,...)                                    \
-    do { if (debugFlag) fprintf (stderr, "DEBUG: %s: %s (" fmt ")\n", category, __func__, __VA_ARGS__); } while (0)
-#else
-#define VIR_DEBUG(category, fmt,...) \
-    do { } while (0)
-#endif /* !ENABLE_DEBUG */
-
-#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt, __VA_ARGS__)
-#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)
-
 /* C99 uses __func__.  __FUNCTION__ is legacy. */
 #ifndef __GNUC__
 #define __FUNCTION__ __func__
index f4dbe684b018e4e3adffe527e6bcb509fd7afcf8..c9936616a66d584d7cc03211a327343818ca51bf 100644 (file)
@@ -32,6 +32,7 @@
 #endif
 
 #include "virterror_internal.h"
+#include "logging.h"
 #include "datatypes.h"
 #include "libvirt_internal.h"
 #include "driver.h"
@@ -83,10 +84,6 @@ static int virStateDriverTabCount = 0;
 #endif
 static int initialized = 0;
 
-#ifdef ENABLE_DEBUG
-int debugFlag = 0;
-#endif
-
 #if defined(POLKIT_AUTH)
 static int virConnectAuthGainPolkit(const char *privilege) {
     const char *const args[] = {
diff --git a/src/logging.c b/src/logging.c
new file mode 100644 (file)
index 0000000..fd15154
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * logging.c: internal logging and debugging
+ *
+ * Copyright (C) 2008 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ */
+
+#include <config.h>
+
+#include "logging.h"
+
+#ifdef ENABLE_DEBUG
+int debugFlag = 0;
+#endif
+
+
diff --git a/src/logging.h b/src/logging.h
new file mode 100644 (file)
index 0000000..2d74adc
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * logging.h: internal logging and debugging
+ *
+ * Copyright (C) 2006-2008 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ */
+
+#ifndef __VIRTLOG_H_
+#define __VIRTLOG_H_
+
+#include "internal.h"
+
+/*
+ * If configured with --enable-debug=yes then library calls
+ * are printed to stderr for debugging or to an appropriate channel
+ * defined at runtime of from the libvirt daemon configuration file
+ */
+#ifdef ENABLE_DEBUG
+extern int debugFlag;
+#define VIR_DEBUG(category, fmt,...)                                    \
+    do { if (debugFlag) fprintf (stderr, "DEBUG: %s: %s (" fmt ")\n", category, __func__, __VA_ARGS__); } while (0)
+#else
+#define VIR_DEBUG(category, fmt,...) \
+    do { } while (0)
+#endif /* !ENABLE_DEBUG */
+
+#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt, __VA_ARGS__)
+#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)
+
+
+#endif
index 3caf7b5c6b03a8cd4b7d74b4f876cc54ae0ec616..1c5891c8a2f1425935f8844e28c5cfbf63b91637 100644 (file)
@@ -42,6 +42,7 @@
 #include <linux/fs.h>
 
 #include "virterror_internal.h"
+#include "logging.h"
 #include "lxc_container.h"
 #include "util.h"
 #include "memory.h"
index 0dc2e71855c878353c00c479b487668bb63c22d4..f5d6188df773ad8af504dbe7d27cbcf990e3bce6 100644 (file)
@@ -35,6 +35,7 @@
 #include <getopt.h>
 
 #include "virterror_internal.h"
+#include "logging.h"
 #include "util.h"
 
 #include "lxc_conf.h"
@@ -44,8 +45,6 @@
 #include "util.h"
 #include "cgroup.h"
 
-int debugFlag = 0;
-
 struct cgroup_device_policy {
     char type;
     int major;
index 5deaff4ceb8f720579ba27a7202799c49889908e..8bfd27d05221651815db30eeb7684b0b7c9a8190 100644 (file)
@@ -36,6 +36,7 @@
 #include <wait.h>
 
 #include "virterror_internal.h"
+#include "logging.h"
 #include "datatypes.h"
 #include "lxc_conf.h"
 #include "lxc_container.h"
index 3211918b1544dc3bef721393f1a37a54f1fd02c8..ca717f5dd724403e30743c3cf0320330ca3c3bb0 100644 (file)
@@ -23,6 +23,7 @@
 #include <string.h>
 
 #include "virterror_internal.h"
+#include "logging.h"
 #include "datatypes.h"
 #include "driver.h"
 #include "proxy_internal.h"
index 5d108edc4d30a0d7ed7ccc53211e485d4df31b75..e6e48862b2dcc2b85a32fedb825b00f6fa9bf558 100644 (file)
@@ -53,6 +53,7 @@
 #endif
 
 #include "virterror_internal.h"
+#include "logging.h"
 #include "datatypes.h"
 #include "qemu_driver.h"
 #include "qemu_conf.h"
 
 static int qemudShutdown(void);
 
-/* qemudDebug statements should be changed to use this macro instead. */
-#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt, __VA_ARGS__)
-#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)
-
 #define qemudLog(level, msg...) fprintf(stderr, msg)
 
 static int qemudSetCloseExec(int fd) {
index 03462b47aa93f708a9c1aa48ab641f32c2f78d44..91dde10a1d6cb9b620598b4d16c296bbe48eba37 100644 (file)
@@ -74,6 +74,7 @@
 #endif
 
 #include "virterror_internal.h"
+#include "logging.h"
 #include "datatypes.h"
 #include "domain_event.h"
 #include "driver.h"
index 2f51f81263c49d9b084370a1878d2d01541628cc..a983cfc817fdf0bb8f8938844f58ad09728a46c1 100644 (file)
@@ -26,6 +26,7 @@
 #include <unistd.h>
 
 #include "virterror_internal.h"
+#include "logging.h"
 #include "storage_backend_disk.h"
 #include "util.h"
 #include "memory.h"
index e155a6a8a99c6fbd025054fefa931e961a873f1b..abc86d6ea2273c0e60e78e3b52500c0e5d0950b1 100644 (file)
@@ -49,6 +49,7 @@
 #endif
 
 #include "virterror_internal.h"
+#include "logging.h"
 #include "event.h"
 #include "buf.h"
 #include "util.h"
index 8de86bc77f81251611d221c190515f1f6242d8b9..ff9bf4d05ec92f5aae8f34dc604cb1c7b55c31d3 100644 (file)
@@ -16,6 +16,7 @@
 
 #include "veth.h"
 #include "internal.h"
+#include "logging.h"
 #include "memory.h"
 #include "util.h"
 
index b86421946c05bf47330d2896560552ba2223b776..04b41b4ac7ed6c18102f6a865f0abf68b1857d51 100644 (file)
@@ -41,6 +41,7 @@
 #include <xen/sched.h>
 
 #include "virterror_internal.h"
+#include "logging.h"
 #include "datatypes.h"
 #include "driver.h"
 #include "util.h"
index 1ab204dfe16eb40c23bf4f419a703154d4872955..dd3887580d75d52583e836a882cf51c5d454a7db 100644 (file)
@@ -28,6 +28,7 @@
 #include <libxml/uri.h>
 
 #include "virterror_internal.h"
+#include "logging.h"
 #include "datatypes.h"
 #include "xen_unified.h"
 
index eba9befe0e2b277399d37bc65eca0ab7d8055a5d..6d2291b78ecc67957a3199c53a0c60f9c643a343 100644 (file)
@@ -33,6 +33,7 @@
 #include <errno.h>
 
 #include "virterror_internal.h"
+#include "logging.h"
 #include "datatypes.h"
 #include "xend_internal.h"
 #include "driver.h"