[PATCH 06/38] virlog: Introduce virLogSetFilters

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

 



This method will eventually replace the existing virLogParseFilters which
currently does both parsing and defining. However, each method should do one
thing only, so will the current virLogParseFilters method will be split into
parsing and defining, only to be swallowed by the entry-point API
virLogSetFilters.
---
 src/libvirt_private.syms |  1 +
 src/util/virlog.c        | 23 +++++++++++++++++++++++
 src/util/virlog.h        |  1 +
 3 files changed, 25 insertions(+)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 684f06c..bd3f72d 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1757,6 +1757,7 @@ virLogPriorityFromSyslog;
 virLogProbablyLogMessage;
 virLogReset;
 virLogSetDefaultPriority;
+virLogSetFilters;
 virLogSetFromEnv;
 virLogUnlock;
 virLogVMessage;
diff --git a/src/util/virlog.c b/src/util/virlog.c
index b893365..0aa722d 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -1493,3 +1493,26 @@ bool virLogProbablyLogMessage(const char *str)
         ret = true;
     return ret;
 }
+
+
+/**
+ * virLogSetFilters:
+ * @filters: string defining a (set of) filter(s)
+ *
+ * Replaces the current set of defined filters with a new set of filters.
+ *
+ * Returns the number of filters successfully defined or -1 in case of an
+ * error.
+ */
+int
+virLogSetFilters(const char *filters)
+{
+    int ret = -1;
+
+    if (virLogInitialize() < 0)
+        return -1;
+
+    ret = virLogParseFilters(filters);
+
+    return ret;
+}
diff --git a/src/util/virlog.h b/src/util/virlog.h
index 36c610b..4d7cc98 100644
--- a/src/util/virlog.h
+++ b/src/util/virlog.h
@@ -183,6 +183,7 @@ extern char *virLogGetOutputs(void);
 extern virLogPriority virLogGetDefaultPriority(void);
 extern int virLogSetDefaultPriority(virLogPriority priority);
 extern void virLogSetFromEnv(void);
+extern int virLogSetFilters(const char *filters);
 extern int virLogDefineFilter(const char *match,
                               virLogPriority priority,
                               unsigned int flags);
-- 
2.4.3

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