Patchwork qemu-log: Introduce qemu_log_mask_vprintf()

login
register
mail settings
Submitter Andreas Färber
Date Feb. 16, 2013, 1:54 p.m.
Message ID <1361022848-5300-1-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/220960/
State New
Headers show

Comments

Andreas Färber - Feb. 16, 2013, 1:54 p.m.
Corresponds to existing qemu_log_vprintf() but uses a mask.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 include/qemu/log.h |    8 ++++++++
 1 Datei geändert, 8 Zeilen hinzugefügt(+)
Markus Armbruster - Feb. 18, 2013, 7:50 a.m.
Andreas Färber <afaerber@suse.de> writes:

> Corresponds to existing qemu_log_vprintf() but uses a mask.
>
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---
>  include/qemu/log.h |    8 ++++++++
>  1 Datei geändert, 8 Zeilen hinzugefügt(+)
>
> diff --git a/include/qemu/log.h b/include/qemu/log.h
> index 58f69cb..4bfa60c 100644
> --- a/include/qemu/log.h
> +++ b/include/qemu/log.h
> @@ -64,6 +64,14 @@ qemu_log_vprintf(const char *fmt, va_list va)
>   */
>  void GCC_FMT_ATTR(2, 3) qemu_log_mask(int mask, const char *fmt, ...);
>  
> +static inline void GCC_FMT_ATTR(2, 0)
> +qemu_log_mask_vprintf(int mask, const char *fmt, va_list va)
> +{
> +    if ((qemu_loglevel & mask) && qemu_logfile) {
> +        vfprintf(qemu_logfile, fmt, va);
> +    }
> +}
> +
>  
>  /* Special cases: */

Got a user?
Andreas Färber - Feb. 18, 2013, 8:37 a.m.
Am 18.02.2013 08:50, schrieb Markus Armbruster:
> Andreas Färber <afaerber@suse.de> writes:
> 
>> Corresponds to existing qemu_log_vprintf() but uses a mask.
>>
>> Signed-off-by: Andreas Färber <afaerber@suse.de>
>> ---
>>  include/qemu/log.h |    8 ++++++++
>>  1 Datei geändert, 8 Zeilen hinzugefügt(+)
>>
>> diff --git a/include/qemu/log.h b/include/qemu/log.h
>> index 58f69cb..4bfa60c 100644
>> --- a/include/qemu/log.h
>> +++ b/include/qemu/log.h
>> @@ -64,6 +64,14 @@ qemu_log_vprintf(const char *fmt, va_list va)
>>   */
>>  void GCC_FMT_ATTR(2, 3) qemu_log_mask(int mask, const char *fmt, ...);
>>  
>> +static inline void GCC_FMT_ATTR(2, 0)
>> +qemu_log_mask_vprintf(int mask, const char *fmt, va_list va)
>> +{
>> +    if ((qemu_loglevel & mask) && qemu_logfile) {
>> +        vfprintf(qemu_logfile, fmt, va);
>> +    }
>> +}
>> +
>>  
>>  /* Special cases: */
> 
> Got a user?

Yes, target-cris I believe in upcoming debug output revamp v2.

Andreas

Patch

diff --git a/include/qemu/log.h b/include/qemu/log.h
index 58f69cb..4bfa60c 100644
--- a/include/qemu/log.h
+++ b/include/qemu/log.h
@@ -64,6 +64,14 @@  qemu_log_vprintf(const char *fmt, va_list va)
  */
 void GCC_FMT_ATTR(2, 3) qemu_log_mask(int mask, const char *fmt, ...);
 
+static inline void GCC_FMT_ATTR(2, 0)
+qemu_log_mask_vprintf(int mask, const char *fmt, va_list va)
+{
+    if ((qemu_loglevel & mask) && qemu_logfile) {
+        vfprintf(qemu_logfile, fmt, va);
+    }
+}
+
 
 /* Special cases: */