[Spice-devel] [vdagent-win PATCH 2/3] Expand PRINT_LINE macros

Christophe Fergeau cfergeau at redhat.com
Wed Jul 26 10:52:16 UTC 2017


Acked-by: Christophe Fergeau <cfergeau at redhat.com>

On Wed, Jul 26, 2017 at 11:03:41AM +0100, Frediano Ziglio wrote:
> This complicated macro was used as an helper for LOG macro
> which expand PRINT_LINE macro twice. Now that LOG expand PRINT_LINE
> only once there's no need to have this macro which make logging code
> more complicated.
> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  common/vdlog.h | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/common/vdlog.h b/common/vdlog.h
> index b1be391..9f08fc4 100644
> --- a/common/vdlog.h
> +++ b/common/vdlog.h
> @@ -58,10 +58,6 @@ static const VDLogLevel log_level = LOG_DEBUG;
>  static const VDLogLevel log_level = LOG_INFO;
>  #endif
>  
> -#define PRINT_LINE(type, format, datetime, ms, ...)                     \
> -    printf("%lu::%s::%s,%.3d::%s::" format "\n", GetCurrentThreadId(), type, datetime, ms, \
> -           __FUNCTION__, ## __VA_ARGS__);
> -
>  #define LOG(type, format, ...) do {                                     \
>      if (type >= log_level && type <= LOG_FATAL) {                       \
>          const char *type_as_char[] = { "DEBUG", "INFO", "WARN", "ERROR", "FATAL" }; \
> @@ -71,7 +67,10 @@ static const VDLogLevel log_level = LOG_INFO;
>          _ftime_s(&now);                                                 \
>          localtime_s(&today, &now.time);                                 \
>          strftime(datetime_str, 20, "%Y-%m-%d %H:%M:%S", &today);        \
> -        VDLog::PRINT_LINE(type_as_char[type], format, datetime_str, now.millitm, ## __VA_ARGS__); \
> +        VDLog::printf("%lu::%s::%s,%.3d::%s::" format "\n",             \
> +                      GetCurrentThreadId(), type_as_char[type],         \
> +                      datetime_str, now.millitm,                        \
> +                      __FUNCTION__, ## __VA_ARGS__);                    \
>      }                                                                   \
>  } while(0)
>  
> -- 
> 2.13.3
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170726/9b93a8f3/attachment.sig>


More information about the Spice-devel mailing list