+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
@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
#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;
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
#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
#include "datatypes.h"
#include "virterror_internal.h"
+#include "logging.h"
#include "memory.h"
/************************************************************************
#include <config.h>
#include "domain_event.h"
+#include "logging.h"
#include "datatypes.h"
#include "memory.h"
#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__
#endif
#include "virterror_internal.h"
+#include "logging.h"
#include "datatypes.h"
#include "libvirt_internal.h"
#include "driver.h"
#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[] = {
--- /dev/null
+/*
+ * 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
+
+
--- /dev/null
+/*
+ * 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
#include <linux/fs.h>
#include "virterror_internal.h"
+#include "logging.h"
#include "lxc_container.h"
#include "util.h"
#include "memory.h"
#include <getopt.h>
#include "virterror_internal.h"
+#include "logging.h"
#include "util.h"
#include "lxc_conf.h"
#include "util.h"
#include "cgroup.h"
-int debugFlag = 0;
-
struct cgroup_device_policy {
char type;
int major;
#include <wait.h>
#include "virterror_internal.h"
+#include "logging.h"
#include "datatypes.h"
#include "lxc_conf.h"
#include "lxc_container.h"
#include <string.h>
#include "virterror_internal.h"
+#include "logging.h"
#include "datatypes.h"
#include "driver.h"
#include "proxy_internal.h"
#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) {
#endif
#include "virterror_internal.h"
+#include "logging.h"
#include "datatypes.h"
#include "domain_event.h"
#include "driver.h"
#include <unistd.h>
#include "virterror_internal.h"
+#include "logging.h"
#include "storage_backend_disk.h"
#include "util.h"
#include "memory.h"
#endif
#include "virterror_internal.h"
+#include "logging.h"
#include "event.h"
#include "buf.h"
#include "util.h"
#include "veth.h"
#include "internal.h"
+#include "logging.h"
#include "memory.h"
#include "util.h"
#include <xen/sched.h>
#include "virterror_internal.h"
+#include "logging.h"
#include "datatypes.h"
#include "driver.h"
#include "util.h"
#include <libxml/uri.h>
#include "virterror_internal.h"
+#include "logging.h"
#include "datatypes.h"
#include "xen_unified.h"
#include <errno.h>
#include "virterror_internal.h"
+#include "logging.h"
#include "datatypes.h"
#include "xend_internal.h"
#include "driver.h"