[PATCH 2/5] Add metadata to virLogOutputFunc

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

 



... and update all users.  No change in functionality, the parameter
will be used in the next patch.

Signed-off-by: Miloslav Trmač <mitr@xxxxxxxxxx>
---
 src/util/logging.c | 14 +++++++++-----
 src/util/logging.h |  2 ++
 tests/testutils.c  |  1 +
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/util/logging.c b/src/util/logging.c
index 71fb6bd..a41ae8b 100644
--- a/src/util/logging.c
+++ b/src/util/logging.c
@@ -123,6 +123,7 @@ static void virLogOutputToFd(virLogSource src,
                              int linenr,
                              const char *funcname,
                              const char *timestamp,
+                             virLogMetadataPtr metadata,
                              unsigned int flags,
                              const char *rawstr,
                              const char *str,
@@ -774,7 +775,7 @@ virLogVMessage(virLogSource source,
                const char *filename,
                int linenr,
                const char *funcname,
-               virLogMetadataPtr metadata ATTRIBUTE_UNUSED,
+               virLogMetadataPtr metadata,
                const char *fmt,
                va_list vargs)
 {
@@ -845,14 +846,14 @@ virLogVMessage(virLogSource source,
                 if (virLogVersionString(&rawver, &ver) >= 0)
                     virLogOutputs[i].f(VIR_LOG_FROM_FILE, VIR_LOG_INFO,
                                        __FILE__, __LINE__, __func__,
-                                       timestamp, 0, rawver, ver,
+                                       timestamp, NULL, 0, rawver, ver,
                                        virLogOutputs[i].data);
                 VIR_FREE(ver);
                 virLogOutputs[i].logVersion = false;
             }
             virLogOutputs[i].f(source, priority,
                                filename, linenr, funcname,
-                               timestamp, filterflags,
+                               timestamp, metadata, filterflags,
                                str, msg, virLogOutputs[i].data);
         }
     }
@@ -863,14 +864,14 @@ virLogVMessage(virLogSource source,
             if (virLogVersionString(&rawver, &ver) >= 0)
                 virLogOutputToFd(VIR_LOG_FROM_FILE, VIR_LOG_INFO,
                                  __FILE__, __LINE__, __func__,
-                                 timestamp, 0, rawver, ver,
+                                 timestamp, NULL, 0, rawver, ver,
                                  (void *) STDERR_FILENO);
             VIR_FREE(ver);
             logVersionStderr = false;
         }
         virLogOutputToFd(source, priority,
                          filename, linenr, funcname,
-                         timestamp, filterflags,
+                         timestamp, metadata, filterflags,
                          str, msg, (void *) STDERR_FILENO);
     }
     virLogUnlock();
@@ -909,6 +910,7 @@ virLogOutputToFd(virLogSource source ATTRIBUTE_UNUSED,
                  int linenr ATTRIBUTE_UNUSED,
                  const char *funcname ATTRIBUTE_UNUSED,
                  const char *timestamp,
+                 virLogMetadataPtr metadata ATTRIBUTE_UNUSED,
                  unsigned int flags,
                  const char *rawstr ATTRIBUTE_UNUSED,
                  const char *str,
@@ -995,6 +997,7 @@ virLogOutputToSyslog(virLogSource source ATTRIBUTE_UNUSED,
                      int linenr ATTRIBUTE_UNUSED,
                      const char *funcname ATTRIBUTE_UNUSED,
                      const char *timestamp ATTRIBUTE_UNUSED,
+                     virLogMetadataPtr metadata ATTRIBUTE_UNUSED,
                      unsigned int flags,
                      const char *rawstr ATTRIBUTE_UNUSED,
                      const char *str,
@@ -1063,6 +1066,7 @@ virLogOutputToJournald(virLogSource source,
                        int linenr,
                        const char *funcname,
                        const char *timestamp ATTRIBUTE_UNUSED,
+                       virLogMetadataPtr metadata ATTRIBUTE_UNUSED,
                        unsigned int flags,
                        const char *rawstr,
                        const char *str ATTRIBUTE_UNUSED,
diff --git a/src/util/logging.h b/src/util/logging.h
index 024814f..52feecc 100644
--- a/src/util/logging.h
+++ b/src/util/logging.h
@@ -111,6 +111,7 @@ typedef struct _virLogMetadata *virLogMetadataPtr;
  * @linenr: line where the message was emitted
  * @funcname: the function emitting the message
  * @timestamp: zero terminated string with timestamp of the message
+ * @metadata: NULL or metadata array, terminated by an item with NULL key
  * @flags: flags associated with the message
  * @rawstr: the unformatted message to log, zero terminated
  * @str: the message to log, preformatted and zero terminated
@@ -124,6 +125,7 @@ typedef void (*virLogOutputFunc) (virLogSource src,
                                   int linenr,
                                   const char *funcname,
                                   const char *timestamp,
+                                  virLogMetadataPtr metadata,
                                   unsigned int flags,
                                   const char *rawstr,
                                   const char *str,
diff --git a/tests/testutils.c b/tests/testutils.c
index 2a9102b..75c7284 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -486,6 +486,7 @@ virtTestLogOutput(virLogSource source ATTRIBUTE_UNUSED,
                   int lineno ATTRIBUTE_UNUSED,
                   const char *funcname ATTRIBUTE_UNUSED,
                   const char *timestamp,
+                  virLogMetadataPtr metadata ATTRIBUTE_UNUSED,
                   unsigned int flags,
                   const char *rawstr ATTRIBUTE_UNUSED,
                   const char *str,
-- 
1.7.11.7

--
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]