From patchwork Tue May 10 17:17:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 1020 Return-Path: Received: from latitanza.investici.org (latitanza.investici.org [82.94.249.234]) by open-mesh.org (Postfix) with ESMTPS id 3FE07154214 for ; Tue, 10 May 2011 19:18:00 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@autistici.org; dkim-adsp=pass Received: from [82.94.249.234] (latitanza [82.94.249.234]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id 917D0981B0; Tue, 10 May 2011 17:17:57 +0000 (UTC) X-DKIM: Sendmail DKIM Filter v2.8.2 latitanza.investici.org 917D0981B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1305047879; bh=0tE/r7fWSz0nMO+yFt0MVLyCNAJsCepLpqdHSaFVX3w=; h=From:To:Cc:Subject:Date:Message-Id; b=FcWreGhr4zjoUAVLqrk1PVmuh4JcKqrR+j9ALsY2AjwsE6Z9HpBczCygTfADpca4x LDMwUNEaHFRcMZZm0sG2WLRPkrsy/X6BbkogH4BybE1kIuBnm9tA4pNH3mpzjpD/RN aiKnaMcVtLZVmBpXO3c+aQ+6C1u9l3lQOsIzYVCc= From: Antonio Quartulli To: "B.A.T.M.A.N" Date: Tue, 10 May 2011 19:17:59 +0200 Message-Id: <1305047879-15897-1-git-send-email-ordex@autistici.org> X-Mailer: git-send-email 1.7.3.4 Subject: [B.A.T.M.A.N.] [PATCH] batctl: added loglevel support for DBG_TT X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2011 17:18:00 -0000 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 --- 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(-) 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)