batctl: added loglevel support for DBG_TT

Message ID 1305047879-15897-1-git-send-email-ordex@autistici.org (mailing list archive)
State Accepted, archived
Commit 24994940e1e8770530c63751a99b4dd82390f1e4
Headers

Commit Message

Antonio Quartulli May 10, 2011, 5:17 p.m. UTC
  DBG_TT log level has been added to batman-adv to collect all the
messages related to Translation Table operations. This patch makes batctl
able to select such level.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
Patch "batman-adv: improved client announcement mechanism" introduces a new log
"channel" called DBG_TT. This patch makes batctl able to correctly handle it


sys.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
  

Comments

Marek Lindner May 30, 2011, 12:09 p.m. UTC | #1
On Tuesday 10 May 2011 19:17:59 Antonio Quartulli wrote:
> DBG_TT log level has been added to batman-adv to collect all the
> messages related to Translation Table operations. This patch makes batctl
> able to select such level.

Applied in revision 2499494.

Thanks,
Marek
  

Patch

diff --git a/sys.c b/sys.c
index f8fa1f2..dbf5383 100644
--- a/sys.c
+++ b/sys.c
@@ -182,6 +182,7 @@  static void log_level_usage(void)
 int handle_loglevel(char *mesh_iface, int argc, char **argv)
 {
 	int optchar, res;
+	int log_level;
 	char *path_buff;
 
 	while ((optchar = getopt(argc, argv, "h")) != -1) {
@@ -208,14 +209,16 @@  int handle_loglevel(char *mesh_iface, int argc, char **argv)
 	if (res != EXIT_SUCCESS)
 		goto out;
 
-	printf("[%c] %s (%d)\n", (line_ptr[0] == '0') ? 'x' : ' ',
+	log_level = strtol(line_ptr, (char **) NULL, 10);
+
+	printf("[%c] %s (%d)\n", (!log_level) ? 'x' : ' ',
 	       "all debug output disabled", 0);
-	printf("[%c] %s (%d)\n", (line_ptr[0] == '1') ? 'x' : ' ',
+	printf("[%c] %s (%d)\n", (log_level & 1) ? 'x' : ' ',
 	       "messages related to routing / flooding / broadcasting", 1);
-	printf("[%c] %s (%d)\n", (line_ptr[0] == '2') ? 'x' : ' ',
-	       "messages related to route or tt entry added / changed / deleted", 2);
-	printf("[%c] %s (%d)\n", (line_ptr[0] == '3') ? 'x' : ' ',
-	       "all debug messages", 3);
+	printf("[%c] %s (%d)\n", (log_level & 2) ? 'x' : ' ',
+	       "messages related to route added / changed / deleted", 2);
+	printf("[%c] %s (%d)\n", (log_level & 4) ? 'x' : ' ',
+	       "messages related to translation table operations", 4);
 
 out:
 	if (errno == ENOENT)