[libvirt] [PATCH] 5/8 converts a few others modules to use the logging

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



  just a few redefines and using the new values,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/
Index: src/node_device_devkit.c
===================================================================
RCS file: /data/cvs/libxen/src/node_device_devkit.c,v
retrieving revision 1.4
diff -u -r1.4 node_device_devkit.c
--- src/node_device_devkit.c	4 Dec 2008 21:48:31 -0000	1.4
+++ src/node_device_devkit.c	17 Dec 2008 14:25:57 -0000
@@ -41,9 +41,6 @@
 
 static virDeviceMonitorStatePtr driverState;
 
-#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt, __VA_ARGS__)
-#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)
-
 #define CONN_DRV_STATE(conn) \
         ((virDeviceMonitorStatePtr)((conn)->devMonPrivateData))
 #define DRV_STATE_DKCLIENT(ds) ((DevkitClient *)((ds)->privateData))
Index: src/uml_conf.c
===================================================================
RCS file: /data/cvs/libxen/src/uml_conf.c,v
retrieving revision 1.3
diff -u -r1.3 uml_conf.c
--- src/uml_conf.c	12 Dec 2008 10:39:19 -0000	1.3
+++ src/uml_conf.c	17 Dec 2008 14:25:57 -0000
@@ -49,10 +49,8 @@
 #include "memory.h"
 #include "verify.h"
 
-
-#define umlLog(level, msg...) fprintf(stderr, msg)
-
-
+#define umlLog(level, msg, ...)                                     \
+        virLogMessage(__FILE__, level, 0, msg, __VA_ARGS__)
 
 #if HAVE_NUMACTL
 #define MAX_CPUS 4096
Index: src/uml_driver.c
===================================================================
RCS file: /data/cvs/libxen/src/uml_driver.c,v
retrieving revision 1.10
diff -u -r1.10 uml_driver.c
--- src/uml_driver.c	10 Dec 2008 16:35:01 -0000	1.10
+++ src/uml_driver.c	17 Dec 2008 14:25:57 -0000
@@ -62,17 +62,15 @@
 #include "uuid.h"
 #include "domain_conf.h"
 #include "datatypes.h"
+#include "logging.h"
 
 /* For storing short-lived temporary files. */
 #define TEMPDIR LOCAL_STATE_DIR "/cache/libvirt"
 
 static int umlShutdown(void);
 
-/* umlDebug 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 umlLog(level, msg...) fprintf(stderr, msg)
+#define umlLog(level, msg, ...)                                     \
+        virLogMessage(__FILE__, level, 0, msg, __VA_ARGS__)
 
 static void umlDriverLock(struct uml_driver *driver)
 {
@@ -100,7 +98,7 @@
         goto error;
     return 0;
  error:
-    umlLog(UML_ERR,
+    umlLog(VIR_LOG_ERROR,
              "%s", _("Failed to set close-on-exec file descriptor flag\n"));
     return -1;
 }
@@ -141,7 +139,7 @@
             !virDomainIsActive(driver->domains.objs[i]) &&
             umlStartVMDaemon(conn, driver, driver->domains.objs[i]) < 0) {
             virErrorPtr err = virGetLastError();
-            umlLog(UML_ERR, _("Failed to autostart VM '%s': %s\n"),
+            umlLog(VIR_LOG_ERROR, _("Failed to autostart VM '%s': %s\n"),
                      driver->domains.objs[i]->def->name, err->message);
         }
     }
@@ -323,7 +321,7 @@
     uml_driver->nextvmid = 1;
 
     if (!(pw = getpwuid(uid))) {
-        umlLog(UML_ERR, _("Failed to find user record for uid '%d': %s\n"),
+        umlLog(VIR_LOG_ERROR, _("Failed to find user record for uid '%d': %s\n"),
                uid, strerror(errno));
         goto error;
     }
@@ -368,12 +366,12 @@
 
 
     if ((uml_driver->inotifyFD = inotify_init()) < 0) {
-        umlLog(UML_ERR, "%s", _("cannot initialize inotify"));
+        umlLog(VIR_LOG_ERROR, "%s", _("cannot initialize inotify"));
         goto error;
     }
 
     if (virFileMakePath(uml_driver->monitorDir) < 0) {
-        umlLog(UML_ERR, _("Failed to create monitor directory %s: %s"),
+        umlLog(VIR_LOG_ERROR, _("Failed to create monitor directory %s: %s"),
                uml_driver->monitorDir, strerror(errno));
         goto error;
     }
@@ -403,7 +401,7 @@
     return 0;
 
 out_of_memory:
-    umlLog (UML_ERR,
+    umlLog (VIR_LOG_ERROR,
               "%s", _("umlStartup: out of memory\n"));
 
 error:
@@ -784,25 +782,25 @@
     tmp = progenv;
     while (*tmp) {
         if (safewrite(logfd, *tmp, strlen(*tmp)) < 0)
-            umlLog(UML_WARN, _("Unable to write envv to logfile %d: %s\n"),
+            umlLog(VIR_LOG_WARN, _("Unable to write envv to logfile %d: %s\n"),
                    errno, strerror(errno));
         if (safewrite(logfd, " ", 1) < 0)
-            umlLog(UML_WARN, _("Unable to write envv to logfile %d: %s\n"),
+            umlLog(VIR_LOG_WARN, _("Unable to write envv to logfile %d: %s\n"),
                    errno, strerror(errno));
         tmp++;
     }
     tmp = argv;
     while (*tmp) {
         if (safewrite(logfd, *tmp, strlen(*tmp)) < 0)
-            umlLog(UML_WARN, _("Unable to write argv to logfile %d: %s\n"),
+            umlLog(VIR_LOG_WARN, _("Unable to write argv to logfile %d: %s\n"),
                    errno, strerror(errno));
         if (safewrite(logfd, " ", 1) < 0)
-            umlLog(UML_WARN, _("Unable to write argv to logfile %d: %s\n"),
+            umlLog(VIR_LOG_WARN, _("Unable to write argv to logfile %d: %s\n"),
                    errno, strerror(errno));
         tmp++;
     }
     if (safewrite(logfd, "\n", 1) < 0)
-        umlLog(UML_WARN, _("Unable to write argv to logfile %d: %s\n"),
+        umlLog(VIR_LOG_WARN, _("Unable to write argv to logfile %d: %s\n"),
                  errno, strerror(errno));
 
     vm->monitor = -1;
@@ -819,7 +817,7 @@
 
     /* Cleanup intermediate proces */
     if (waitpid(pid, NULL, 0) != pid)
-        umlLog(UML_WARN, _("failed to wait on process: %d: %s\n"),
+        umlLog(VIR_LOG_WARN, _("failed to wait on process: %d: %s\n"),
                pid, strerror(errno));
 
     for (i = 0 ; argv[i] ; i++)
@@ -860,7 +858,7 @@
     vm->monitor = -1;
 
     if ((ret = waitpid(vm->pid, NULL, 0)) != vm->pid) {
-        umlLog(UML_WARN,
+        umlLog(VIR_LOG_WARN,
                _("Got unexpected pid %d != %d\n"),
                ret, vm->pid);
     }
--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]