提交 df93e1ee 编写于 作者: D Daniel Veillard

add new logging module, and move existing definitions there

* 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
上级 3796e580
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
......
......@@ -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
......
......@@ -32,11 +32,6 @@
#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;
......
......@@ -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
......
......@@ -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
......
......@@ -23,6 +23,7 @@
#include "datatypes.h"
#include "virterror_internal.h"
#include "logging.h"
#include "memory.h"
/************************************************************************
......
......@@ -23,6 +23,7 @@
#include <config.h>
#include "domain_event.h"
#include "logging.h"
#include "datatypes.h"
#include "memory.h"
......
......@@ -71,21 +71,6 @@
#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__
......
......@@ -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[] = {
......
/*
* 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
/*
* 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
......@@ -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"
......
......@@ -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;
......
......@@ -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"
......
......@@ -23,6 +23,7 @@
#include <string.h>
#include "virterror_internal.h"
#include "logging.h"
#include "datatypes.h"
#include "driver.h"
#include "proxy_internal.h"
......
......@@ -53,6 +53,7 @@
#endif
#include "virterror_internal.h"
#include "logging.h"
#include "datatypes.h"
#include "qemu_driver.h"
#include "qemu_conf.h"
......@@ -72,10 +73,6 @@
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) {
......
......@@ -74,6 +74,7 @@
#endif
#include "virterror_internal.h"
#include "logging.h"
#include "datatypes.h"
#include "domain_event.h"
#include "driver.h"
......
......@@ -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"
......
......@@ -49,6 +49,7 @@
#endif
#include "virterror_internal.h"
#include "logging.h"
#include "event.h"
#include "buf.h"
#include "util.h"
......
......@@ -16,6 +16,7 @@
#include "veth.h"
#include "internal.h"
#include "logging.h"
#include "memory.h"
#include "util.h"
......
......@@ -41,6 +41,7 @@
#include <xen/sched.h>
#include "virterror_internal.h"
#include "logging.h"
#include "datatypes.h"
#include "driver.h"
#include "util.h"
......
......@@ -28,6 +28,7 @@
#include <libxml/uri.h>
#include "virterror_internal.h"
#include "logging.h"
#include "datatypes.h"
#include "xen_unified.h"
......
......@@ -33,6 +33,7 @@
#include <errno.h>
#include "virterror_internal.h"
#include "logging.h"
#include "datatypes.h"
#include "xend_internal.h"
#include "driver.h"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册