* [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
* Re: [PATCH] shared/tester: Add support for debug logs for tester
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
1 sibling, 0 replies; 4+ messages in thread
From: Grzegorz Kolodziejczyk @ 2014-05-21 7:46 UTC (permalink / raw)
To: linux-bluetooth
Ping
On 7 May 2014 16:45, Grzegorz Kolodziejczyk
<grzegorz.kolodziejczyk@tieto.com> wrote:
> 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 [flat|nested] 4+ messages in thread
* Re: [PATCH] shared/tester: Add support for debug logs for tester
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
1 sibling, 1 reply; 4+ messages in thread
From: Johan Hedberg @ 2014-05-21 11:05 UTC (permalink / raw)
To: Grzegorz Kolodziejczyk; +Cc: linux-bluetooth
Hi Grzegorz,
On Wed, May 07, 2014, Grzegorz Kolodziejczyk wrote:
> +void tester_debug(const char *format, ...)
> +{
> + va_list ap;
> +
> + if (!tester_use_debug())
> + return;
> +
> + printf(" tester-dbg: %s", COLOR_WHITE);
I think it'd be good to make the prefix consistent with the other
logging functions here. Do we really need to know that a line is a debug
print? Isn't it simply enough that the line is printed when debugging is
enabled? I don't see any special identifiers for the other types of logs
either. So unless there's a good reason to have it I'd just keep this
consistent with the other logs.
Johan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] shared/tester: Add support for debug logs for tester
2014-05-21 11:05 ` Johan Hedberg
@ 2014-05-21 11:55 ` Grzegorz Kolodziejczyk
0 siblings, 0 replies; 4+ messages in thread
From: Grzegorz Kolodziejczyk @ 2014-05-21 11:55 UTC (permalink / raw)
To: Grzegorz Kolodziejczyk, linux-bluetooth
Hi Johan,
On 21 May 2014 13:05, Johan Hedberg <johan.hedberg@gmail.com> wrote:
> Hi Grzegorz,
>
> On Wed, May 07, 2014, Grzegorz Kolodziejczyk wrote:
>> +void tester_debug(const char *format, ...)
>> +{
>> + va_list ap;
>> +
>> + if (!tester_use_debug())
>> + return;
>> +
>> + printf(" tester-dbg: %s", COLOR_WHITE);
>
> I think it'd be good to make the prefix consistent with the other
> logging functions here. Do we really need to know that a line is a debug
> print? Isn't it simply enough that the line is printed when debugging is
> enabled? I don't see any special identifiers for the other types of logs
> either. So unless there's a good reason to have it I'd just keep this
> consistent with the other logs.
Ok, I agree. I'll send fixed v2.
>
> Johan
Best regards,
Grzegorz
^ permalink raw reply [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