Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] shared/tester: Add support for debug logs for tester
@ 2014-05-07 14:45 Grzegorz Kolodziejczyk
  2014-05-21  7:46 ` Grzegorz Kolodziejczyk
  2014-05-21 11:05 ` Johan Hedberg
  0 siblings, 2 replies; 4+ messages in thread
From: Grzegorz Kolodziejczyk @ 2014-05-07 14:45 UTC (permalink / raw)
  To: linux-bluetooth

It allows to print debug logs if debug mode is enabled. It could help in
case of additional debug prints need (verbose mode).
---
 src/shared/tester.c | 14 ++++++++++++++
 src/shared/tester.h |  2 ++
 2 files changed, 16 insertions(+)

diff --git a/src/shared/tester.c b/src/shared/tester.c
index 56e5696..7f1b980 100644
--- a/src/shared/tester.c
+++ b/src/shared/tester.c
@@ -134,6 +134,20 @@ void tester_print(const char *format, ...)
 	printf("%s\n", COLOR_OFF);
 }
 
+void tester_debug(const char *format, ...)
+{
+	va_list ap;
+
+	if (!tester_use_debug())
+		return;
+
+	printf("   tester-dbg: %s", COLOR_WHITE);
+	va_start(ap, format);
+	vprintf(format, ap);
+	va_end(ap);
+	printf("%s\n", COLOR_OFF);
+}
+
 void tester_warn(const char *format, ...)
 {
 	va_list ap;
diff --git a/src/shared/tester.h b/src/shared/tester.h
index 85d5e95..0231f19 100644
--- a/src/shared/tester.h
+++ b/src/shared/tester.h
@@ -33,6 +33,8 @@ void tester_print(const char *format, ...)
 				__attribute__((format(printf, 1, 2)));
 void tester_warn(const char *format, ...)
 				__attribute__((format(printf, 1, 2)));
+void tester_debug(const char *format, ...)
+				__attribute__((format(printf, 1, 2)));
 
 typedef void (*tester_destroy_func_t)(void *user_data);
 typedef void (*tester_data_func_t)(const void *test_data);
-- 
1.9.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-05-21 11:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-07 14:45 [PATCH] shared/tester: Add support for debug logs for tester Grzegorz Kolodziejczyk
2014-05-21  7:46 ` Grzegorz Kolodziejczyk
2014-05-21 11:05 ` Johan Hedberg
2014-05-21 11:55   ` Grzegorz Kolodziejczyk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox