Skip to contentSkip to conversation

rte_log.h: display level in logs from RTE_LOG

PATCH In review Matthew Hall 3 participants 4 messages Nov 13, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rte_log.h: display level in logs from RTE_LOG

---
 lib/librte_eal/common/include/rte_log.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
lib/librte_eal/common/include/rte_log.h +4 -4
index ede0dca..be961d0 100644
@@ -297,10 +297,10 @@ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap)
  *   - 0: Success.
  *   - Negative on error.
  */
-#define RTE_LOG(l, t, ...)					\
-	(void)((RTE_LOG_ ## l <= RTE_LOG_LEVEL) ?		\
-	 rte_log(RTE_LOG_ ## l,					\
-		 RTE_LOGTYPE_ ## t, # t ": " __VA_ARGS__) :	\
+#define RTE_LOG(l, t, ...)						\
+	(void)((RTE_LOG_ ## l <= RTE_LOG_LEVEL) ?			\
+	 rte_log(RTE_LOG_ ## l,						\
+		 RTE_LOGTYPE_ ## t, # t ": " #l ": " __VA_ARGS__) :	\
 	 0)
 
 #ifdef __cplusplus
Signature · 1 line
1.9.1
#1 lore raw
Quoted 15 lines · Matthew Hall
---
  lib/librte_eal/common/include/rte_log.h | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
lib/librte_eal/common/include/rte_log.h +0 -1
index ede0dca..be961d0 100644
@@ -297,10 +297,10 @@ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap)
   *   - 0: Success.
   *   - Negative on error.
   */
-#define RTE_LOG(l, t, ...)					\

lib/librte_eal/common/include/rte_log.h int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap) · line 306

Quoted 10 lines
lib/librte_eal/common/include/rte_log.h +4 -3
-	(void)((RTE_LOG_ ## l <= RTE_LOG_LEVEL) ?		\
-	 rte_log(RTE_LOG_ ## l,					\
-		 RTE_LOGTYPE_ ## t, # t ": " __VA_ARGS__) :	\
+#define RTE_LOG(l, t, ...)						\
+	(void)((RTE_LOG_ ## l <= RTE_LOG_LEVEL) ?			\
+	 rte_log(RTE_LOG_ ## l,						\
+		 RTE_LOGTYPE_ ## t, # t ": " #l ": " __VA_ARGS__) :	\
  	 0)
 
  #ifdef __cplusplus

+1 for this, makes it much easier to spot the actually important messages from all the other noise. Both visually and programmatically.

- Panu -

#2 lore raw
Quoted 24 lines · On Fri, 13 Nov 2015 15:11:09 +0200 Panu Matilainen <[email protected]> wrote:
Quoted 23 lines · Matthew Hall
---
  lib/librte_eal/common/include/rte_log.h | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
lib/librte_eal/common/include/rte_log.h +4 -4
index ede0dca..be961d0 100644
@@ -297,10 +297,10 @@ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap)
   *   - 0: Success.
   *   - Negative on error.
   */
-#define RTE_LOG(l, t, ...)					\
-	(void)((RTE_LOG_ ## l <= RTE_LOG_LEVEL) ?		\
-	 rte_log(RTE_LOG_ ## l,					\
-		 RTE_LOGTYPE_ ## t, # t ": " __VA_ARGS__) :	\
+#define RTE_LOG(l, t, ...)						\
+	(void)((RTE_LOG_ ## l <= RTE_LOG_LEVEL) ?			\
+	 rte_log(RTE_LOG_ ## l,						\
+		 RTE_LOGTYPE_ ## t, # t ": " #l ": " __VA_ARGS__) :	\
  	 0)
 
Quoted 7 lines

lib/librte_eal/common/include/rte_log.h int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap) · line 306

Quoted 2 lines
lib/librte_eal/common/include/rte_log.h +0 -0
  #ifdef __cplusplus

+1 for this, makes it much easier to spot the actually important messages from all the other noise. Both visually and programmatically.

- Panu -

-1
This is already done by syslog and friends and adds more cruft to log messages.

#3 lore raw
Quoted 2 lines · Stephen Hemminger

-1
This is already done by syslog and friends and adds more cruft to log messages.

On the console it is not.

Matthew.