netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Quentin Monnet <quentin.monnet@netronome.com>
To: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>
Cc: bpf@vger.kernel.org, netdev@vger.kernel.org,
	oss-drivers@netronome.com,
	Quentin Monnet <quentin.monnet@netronome.com>
Subject: [PATCH bpf-next 2/6] tools: bpftool: add --log-all option to print all possible log info
Date: Mon, 29 Apr 2019 10:52:23 +0100	[thread overview]
Message-ID: <20190429095227.9745-3-quentin.monnet@netronome.com> (raw)
In-Reply-To: <20190429095227.9745-1-quentin.monnet@netronome.com>

The --log-all option is a shortcut for "--log-libbpf warn,info,debug".
It tells bpftool to print all possible logs from libbpf, and may be
extended in the future to set other log levels from other components as
well.

This option has a short name: "-l".

Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
 tools/bpf/bpftool/Documentation/bpftool-prog.rst | 4 ++++
 tools/bpf/bpftool/bash-completion/bpftool        | 3 ++-
 tools/bpf/bpftool/main.c                         | 7 ++++++-
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/tools/bpf/bpftool/Documentation/bpftool-prog.rst b/tools/bpf/bpftool/Documentation/bpftool-prog.rst
index 77d9570488d1..0525275f79f1 100644
--- a/tools/bpf/bpftool/Documentation/bpftool-prog.rst
+++ b/tools/bpf/bpftool/Documentation/bpftool-prog.rst
@@ -180,6 +180,10 @@ OPTIONS
 		  levels of information to print, which can be **warn**,
 		  **info** or **debug**. The default is **warn,info**.
 
+	-l, --log-all
+		  Print all possible log information. This is a shortcut for
+		  **--log-libbpf warn,info,debug**.
+
 EXAMPLES
 ========
 **# bpftool prog show**
diff --git a/tools/bpf/bpftool/bash-completion/bpftool b/tools/bpf/bpftool/bash-completion/bpftool
index a232da1b158d..f4ad75c6b243 100644
--- a/tools/bpf/bpftool/bash-completion/bpftool
+++ b/tools/bpf/bpftool/bash-completion/bpftool
@@ -209,7 +209,8 @@ _bpftool()
 
     # Deal with options
     if [[ ${words[cword]} == -* ]]; then
-        local c='--version --json --pretty --bpffs --mapcompat --log-libbpf'
+        local c='--version --json --pretty --bpffs --mapcompat \
+            --log-libbpf --log-all'
         COMPREPLY=( $( compgen -W "$c" -- "$cur" ) )
         return 0
     fi
diff --git a/tools/bpf/bpftool/main.c b/tools/bpf/bpftool/main.c
index 6318be6feb5c..417cff76c7a1 100644
--- a/tools/bpf/bpftool/main.c
+++ b/tools/bpf/bpftool/main.c
@@ -360,6 +360,7 @@ int main(int argc, char **argv)
 		{ "mapcompat",	no_argument,		NULL,	'm' },
 		{ "nomount",	no_argument,		NULL,	'n' },
 		{ "log-libbpf",	required_argument,	NULL,	'd' },
+		{ "log-all",	no_argument,		NULL,	'l' },
 		{ 0 }
 	};
 	int opt, ret;
@@ -375,7 +376,7 @@ int main(int argc, char **argv)
 	hash_init(map_table.table);
 
 	opterr = 0;
-	while ((opt = getopt_long(argc, argv, "Vhpjfmn",
+	while ((opt = getopt_long(argc, argv, "Vhpjfmnl",
 				  options, NULL)) >= 0) {
 		switch (opt) {
 		case 'V':
@@ -409,6 +410,10 @@ int main(int argc, char **argv)
 			if (set_libbpf_loglevel(optarg))
 				return -1;
 			break;
+		case 'l':
+			if (set_libbpf_loglevel("warn,info,debug"))
+				return -1;
+			break;
 		default:
 			p_err("unrecognized option '%s'", argv[optind - 1]);
 			if (json_output)
-- 
2.17.1


  parent reply	other threads:[~2019-04-29  9:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-29  9:52 [PATCH bpf-next 0/6] tools: bpftool: add options for debug info from libbpf and verifier Quentin Monnet
2019-04-29  9:52 ` [PATCH bpf-next 1/6] tools: bpftool: add --log-libbpf option to get debug info from libbpf Quentin Monnet
2019-04-29 23:32   ` Y Song
2019-04-30  9:34     ` Quentin Monnet
2019-04-30 15:31       ` Y Song
2019-04-30 19:39         ` Jakub Kicinski
2019-04-29  9:52 ` Quentin Monnet [this message]
2019-04-29  9:52 ` [PATCH bpf-next 3/6] libbpf: add bpf_object__load_xattr() API function to pass log_level Quentin Monnet
2019-04-29  9:52 ` [PATCH bpf-next 4/6] bpf: make BPF_LOG_* flags available in UAPI header Quentin Monnet
2019-05-05  6:19   ` Alexei Starovoitov
2019-05-07 17:06     ` Quentin Monnet
2019-04-29  9:52 ` [PATCH bpf-next 5/6] tools: bpf: report latest changes from BPF UAPI header to tools Quentin Monnet
2019-04-29  9:52 ` [PATCH bpf-next 6/6] tools: bpftool: add --log-verifier option to print kernel debug logs Quentin Monnet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190429095227.9745-3-quentin.monnet@netronome.com \
    --to=quentin.monnet@netronome.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@netronome.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).