From e9703de76c75fb6ce0c63593724228d945a90c46 Mon Sep 17 00:00:00 2001
From: Matthew Hall <mhall@mhcomputing.net>
Date: Sun, 14 Sep 2014 01:34:46 -0700
Subject: [PATCH] log: add function to retrieve log level

It is helpful when you want outside code to cooperate with and respect
log levels set in DPDK. Then you can avoid using duplicate incompatible
log code in the DPDK and non-DPDK parts of the app.

Signed-off-by: Matthew Hall <mhall@mhcomputing.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
[Thomas: add void to fix function signature]
---
 lib/librte_eal/common/eal_common_log.c  | 7 +++++++
 lib/librte_eal/common/include/rte_log.h | 5 +++++
 2 files changed, 12 insertions(+)

diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c
index e4df0b90a9..cf576195e3 100644
--- a/lib/librte_eal/common/eal_common_log.c
+++ b/lib/librte_eal/common/eal_common_log.c
@@ -176,6 +176,13 @@ rte_set_log_level(uint32_t level)
 	rte_logs.level = (uint32_t)level;
 }
 
+/* Get global log level */
+uint32_t
+rte_get_log_level(void)
+{
+	return rte_logs.level;
+}
+
 /* Set global log type */
 void
 rte_set_log_type(uint32_t type, int enable)
diff --git a/lib/librte_eal/common/include/rte_log.h b/lib/librte_eal/common/include/rte_log.h
index 565415af16..02cbb14a32 100644
--- a/lib/librte_eal/common/include/rte_log.h
+++ b/lib/librte_eal/common/include/rte_log.h
@@ -129,6 +129,11 @@ int rte_openlog_stream(FILE *f);
  */
 void rte_set_log_level(uint32_t level);
 
+/**
+ * Get the global log level.
+ */
+uint32_t rte_get_log_level(void);
+
 /**
  * Enable or disable the log type.
  *
-- 
2.39.5