log: add function to retrieve log level
authorMatthew Hall <mhall@mhcomputing.net>
Sun, 14 Sep 2014 08:34:46 +0000 (01:34 -0700)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Thu, 18 Sep 2014 13:26:55 +0000 (15:26 +0200)
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
lib/librte_eal/common/include/rte_log.h

index e4df0b9..cf57619 100644 (file)
@@ -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)
index 565415a..02cbb14 100644 (file)
@@ -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.
  *