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

[libvirt] [PATCH 07/38] virlog: Introduce virLogSetOutputs



This API is the entry point to output modification of the logger. Currently,
everything is done by virLogParseOutputs which should do parsing only and
a separate method which will do the definition part should be added.
---
 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 bd3f72d..99b3b55 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1759,6 +1759,7 @@ virLogReset;
 virLogSetDefaultPriority;
 virLogSetFilters;
 virLogSetFromEnv;
+virLogSetOutputs;
 virLogUnlock;
 virLogVMessage;
 
diff --git a/src/util/virlog.c b/src/util/virlog.c
index 0aa722d..2cd3773 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -1516,3 +1516,26 @@ virLogSetFilters(const char *filters)
 
     return ret;
 }
+
+
+/**
+ * virLogSetOutputs:
+ * @outputs: string defining a (set of) output(s)
+ *
+ * Replaces the current set of defined outputs with a new set of outputs.
+ *
+ * Returns the number of outputs successfully defined or -1 in case of an
+ * error.
+ */
+int
+virLogSetOutputs(const char *outputs)
+{
+    int ret = -1;
+
+    if (virLogInitialize() < 0)
+        return -1;
+
+    ret = virLogParseOutputs(outputs);
+
+    return ret;
+}
diff --git a/src/util/virlog.h b/src/util/virlog.h
index 4d7cc98..4141ecd 100644
--- a/src/util/virlog.h
+++ b/src/util/virlog.h
@@ -184,6 +184,7 @@ extern virLogPriority virLogGetDefaultPriority(void);
 extern int virLogSetDefaultPriority(virLogPriority priority);
 extern void virLogSetFromEnv(void);
 extern int virLogSetFilters(const char *filters);
+extern int virLogSetOutputs(const char *outputs);
 extern int virLogDefineFilter(const char *match,
                               virLogPriority priority,
                               unsigned int flags);
-- 
2.4.3


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