Skip to contentSkip to conversation

librte_log: add function to retrieve log_level

PATCH In review Matthew Hall 3 participants 8 messages Sep 14, 2014 – Sep 18, 2014 4 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 librte_log: add function to retrieve log_level

---
 lib/librte_eal/common/eal_common_log.c  | 7 +++++++
 lib/librte_eal/common/include/rte_log.h | 6 ++++++
 2 files changed, 13 insertions(+)
lib/librte_eal/common/eal_common_log.c +7 -0
index e4df0b9..d979f28 100644
@@ -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()
+{
+	return rte_logs.level;
+}
+
 /* Set global log type */
 void
 rte_set_log_type(uint32_t type, int enable)
lib/librte_eal/common/include/rte_log.h +6 -0
index 565415a..7f1c2f9 100644
@@ -130,6 +130,12 @@ 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.
  *
  * @param type
Signature · 1 line
1.9.1

A message that is not in the archive (sent off-list or not yet received): 1410683686-12389-1-git-send-email-mhall-Hv3ogNYU3JfZZajBQzqCxQ@public.gmane.org

#2 lore raw
Quoted 5 lines · Matthew Hall
---
 lib/librte_eal/common/eal_common_log.c  | 7 +++++++
 lib/librte_eal/common/include/rte_log.h | 6 ++++++
 2 files changed, 13 insertions(+)

I forgot to mention in the comments, this patch 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.

Matthew.

#3 lore raw
In reply to a message not in the archive
Quoted 7 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Matthew Hall
Sent: Sunday, September 14, 2014 9:35 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH] librte_log: add function to retrieve log_level

Quoted 44 lines
---
 lib/librte_eal/common/eal_common_log.c  | 7 +++++++
 lib/librte_eal/common/include/rte_log.h | 6 ++++++
 2 files changed, 13 insertions(+)
lib/librte_eal/common/eal_common_log.c +7 -0
index e4df0b9..d979f28 100644
@@ -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()
+{
+	return rte_logs.level;
+}
+
 /* Set global log type */
 void
 rte_set_log_type(uint32_t type, int enable)
lib/librte_eal/common/include/rte_log.h +6 -1
index 565415a..7f1c2f9 100644
@@ -130,6 +130,12 @@ 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.
  *
  * @param type
--

1.9.1

A message that is not in the archive (sent off-list or not yet received): 59AF69C657FD0841A61C55336867B5B0343F15D6-kPTMFJFq+rELt2AQoY/[email protected]

#5 lore raw

Thanks for the ack Bruce! Used this one to clean up a lot of grubby app-side code and I hate forking open source for too long if it can be avoided.

Matthew.

Signature · 1 line
Sent from my mobile device.
Quoted 54 lines · Bruce
Quoted 5 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Matthew Hall
Sent: Sunday, September 14, 2014 9:35 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH] librte_log: add function to retrieve

log_level

Quoted 2 lines
Quoted 44 lines
---
 lib/librte_eal/common/eal_common_log.c  | 7 +++++++
 lib/librte_eal/common/include/rte_log.h | 6 ++++++
 2 files changed, 13 insertions(+)
lib/librte_eal/common/eal_common_log.c +7 -0
index e4df0b9..d979f28 100644
@@ -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()
+{
+	return rte_logs.level;
+}
+
 /* Set global log type */
 void
 rte_set_log_type(uint32_t type, int enable)
lib/librte_eal/common/include/rte_log.h +6 -1
index 565415a..7f1c2f9 100644
@@ -130,6 +130,12 @@ 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.
  *
  * @param type
--

1.9.1

A message that is not in the archive (sent off-list or not yet received): 515e4bf4-8e68-4d46-bf05-677e02717768-2ueSQiBKiTY7tOexoI0I+QC/[email protected]

#7 lore raw
Quoted 8 lines

-----Original Message-----
From: Matthew Hall [mailto:[email protected]]
Sent: Monday, September 15, 2014 9:17 AM
To: Richardson, Bruce; [email protected]
Subject: RE: [dpdk-dev] [PATCH] librte_log: add function to retrieve log_level

Thanks for the ack Bruce! Used this one to clean up a lot of grubby app-side code and I hate forking open source for too long if it can be avoided.

No problem. With such huge patches as this the code review takes many hours of strenuous effort! :-)

/Bruce

Quoted 61 lines

Matthew.
--
Sent from my mobile device.

Quoted 54 lines · Bruce
Quoted 5 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Matthew Hall
Sent: Sunday, September 14, 2014 9:35 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH] librte_log: add function to retrieve

log_level

Quoted 2 lines
Quoted 44 lines
---
 lib/librte_eal/common/eal_common_log.c  | 7 +++++++
 lib/librte_eal/common/include/rte_log.h | 6 ++++++
 2 files changed, 13 insertions(+)
lib/librte_eal/common/eal_common_log.c +7 -0
index e4df0b9..d979f28 100644
@@ -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()
+{
+	return rte_logs.level;
+}
+
 /* Set global log type */
 void
 rte_set_log_type(uint32_t type, int enable)
lib/librte_eal/common/include/rte_log.h +6 -1
index 565415a..7f1c2f9 100644
@@ -130,6 +130,12 @@ 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.
  *
  * @param type
--

1.9.1

A message that is not in the archive (sent off-list or not yet received): 59AF69C657FD0841A61C55336867B5B0343F1631-kPTMFJFq+rELt2AQoY/[email protected]

#9 lore raw

The real effort was the client-side cleanup. I had to get rid of pages of logs for every packet flowing through and I hate yanking out logs... but some of them call weird functions like memdump and pktmbuf_dump. There's no good way to clean those up without a function to check the current loglevel. And reaching into private structs to get it seemed like an uncivilized thing to do.

Good news is, another couple weeks and some Coverity patches and I'll have shareable code to hand out.

Signature · 1 line
Sent from my mobile device.
Quoted 77 lines · Bruce
Quoted 5 lines

-----Original Message-----
From: Matthew Hall [mailto:[email protected]]
Sent: Monday, September 15, 2014 9:17 AM
To: Richardson, Bruce; [email protected]
Subject: RE: [dpdk-dev] [PATCH] librte_log: add function to retrieve

log_level

Quoted 2 lines

Thanks for the ack Bruce! Used this one to clean up a lot of grubby

app-side

Quoted 1 line

code and I hate forking open source for too long if it can be

avoided.

No problem. With such huge patches as this the code review takes many hours of strenuous effort! :-)

/Bruce

Quoted 61 lines

Matthew.
--
Sent from my mobile device.

Quoted 54 lines · Bruce
Quoted 5 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Matthew Hall
Sent: Sunday, September 14, 2014 9:35 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH] librte_log: add function to retrieve

log_level

Quoted 2 lines
Quoted 44 lines
---
 lib/librte_eal/common/eal_common_log.c  | 7 +++++++
 lib/librte_eal/common/include/rte_log.h | 6 ++++++
 2 files changed, 13 insertions(+)
lib/librte_eal/common/eal_common_log.c +7 -0
index e4df0b9..d979f28 100644
@@ -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()
+{
+	return rte_logs.level;
+}
+
 /* Set global log type */
 void
 rte_set_log_type(uint32_t type, int enable)
lib/librte_eal/common/include/rte_log.h +6 -1
index 565415a..7f1c2f9 100644
@@ -130,6 +130,12 @@ 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.
  *
  * @param type
--

1.9.1

#10 lore raw
In reply to a message not in the archive
Quoted 7 lines
Quoted 1 line

lib/librte_eal/common/eal_common_log.c rte_set_log_level(uint32_t level) · line 181

Quoted 3 lines
lib/librte_eal/common/eal_common_log.c +3 -0
+/* Get global log level */
+uint32_t
+rte_get_log_level()

void is missing here

Applied with fix and commit log which was sent later.

Thanks

Signature · 1 line
Thomas
#11 lore raw
Quoted 1 line · Thomas Monjalon

void is missing here

Ah yes, sorry for missing it.

Thanks for correcting and applying, glad to have it available upstream.

Matthew.