Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Wood <thomas.wood@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH i-g-t 4/5] lib: add optional log domain filtering
Date: Tue,  2 Dec 2014 17:15:38 +0000	[thread overview]
Message-ID: <1417540539-23069-4-git-send-email-thomas.wood@intel.com> (raw)
In-Reply-To: <1417540539-23069-1-git-send-email-thomas.wood@intel.com>

Signed-off-by: Thomas Wood <thomas.wood@intel.com>
---
 lib/igt_core.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 4f4cf96..d53fabb 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -228,6 +228,8 @@ enum {
  OPT_HELP = 'h'
 };
 
+static char* igt_log_domain_filter;
+
 __attribute__((format(printf, 1, 2)))
 static void kmsg(const char *format, ...)
 #define KERN_EMER	"<0>"
@@ -390,7 +392,7 @@ static void print_usage(const char *help_str, bool output_on_stderr)
 	fprintf(f, "Usage: %s [OPTIONS]\n", command_str);
 	fprintf(f, "  --list-subtests\n"
 		   "  --run-subtest <pattern>\n"
-		   "  --debug\n"
+		   "  --debug[=log-domain]\n"
 		   "  --help-description\n"
 		   "  --help\n");
 	if (help_str)
@@ -422,7 +424,7 @@ static int common_init(int argc, char **argv,
 		{"list-subtests", 0, 0, OPT_LIST_SUBTESTS},
 		{"run-subtest", 1, 0, OPT_RUN_SUBTEST},
 		{"help-description", 0, 0, OPT_DESCRIPTION},
-		{"debug", 0, 0, OPT_DEBUG},
+		{"debug", optional_argument, 0, OPT_DEBUG},
 		{"help", 0, 0, OPT_HELP},
 		{0, 0, 0, 0}
 	};
@@ -510,6 +512,8 @@ static int common_init(int argc, char **argv,
 		switch(c) {
 		case OPT_DEBUG:
 			igt_log_level = IGT_LOG_DEBUG;
+			if (optarg)
+				igt_log_domain_filter = strdup(optarg);
 			break;
 		case OPT_LIST_SUBTESTS:
 			if (!run_single_subtest)
@@ -1463,9 +1467,15 @@ void igt_vlog(const char *domain, enum igt_log_level level, const char *format,
 	if (igt_log_level > level)
 		return;
 
+	if (igt_log_level > level)
+		return;
+
 	if (!domain)
 		domain = command_str;
 
+	if (igt_log_domain_filter && strcmp(igt_log_domain_filter, domain))
+		return;
+
 	if (level == IGT_LOG_WARN) {
 		file = stderr;
 		fflush(stdout);
-- 
2.1.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2014-12-02 17:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-02 17:15 [PATCH i-g-t 1/5] lib: share common logging code Thomas Wood
2014-12-02 17:15 ` [PATCH i-g-t 2/5] tests/gem_tiled_swapping: use igt_info logging wrapper Thomas Wood
2014-12-02 17:15 ` [PATCH i-g-t 3/5] lib: introduce log domains Thomas Wood
2014-12-03 14:22   ` Daniel Vetter
2014-12-04 10:58     ` Thomas Wood
2014-12-10 17:24       ` [PATCH i-g-t v2 1/2] " Thomas Wood
2014-12-10 17:24         ` [PATCH i-g-t v2 2/2] lib: add optional log domain filtering Thomas Wood
2014-12-02 17:15 ` Thomas Wood [this message]
2014-12-02 17:15 ` [PATCH i-g-t 5/5] lib: write out recent log output if a test fails Thomas Wood

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=1417540539-23069-4-git-send-email-thomas.wood@intel.com \
    --to=thomas.wood@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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