Re: [PATCH spice-common 3/3] log: Check log level from spice_logv

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2017-05-31 at 08:53 +0100, Frediano Ziglio wrote:
> This was suggested by Christophe de Dinechin as an optimisation.
> Most of the messages won't be processed for formatting.
> 
> Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> ---
>  common/log.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/common/log.c b/common/log.c
> index dae955a..bab1afa 100644
> --- a/common/log.c
> +++ b/common/log.c
> @@ -153,6 +153,11 @@ static void spice_logv(const char *log_domain,
>                         va_list args)
>  {
>      GString *log_msg;
> +    GLogLevelFlags glib_level = spice_log_level_to_glib(log_level);
> +
> +    if ((glib_level & G_LOG_LEVEL_MASK) > glib_debug_level) {
> +            return; // do not print anything
indentation

> +    }
>  
>      log_msg = g_string_new(NULL);
>      if (strloc && function) {
> @@ -161,7 +166,7 @@ static void spice_logv(const char *log_domain,
>      if (format) {
>          g_string_append_vprintf(log_msg, format, args);
>      }
> -    g_log(log_domain, spice_log_level_to_glib(log_level), "%s",
> log_msg->str);
> +    g_log(log_domain, glib_level, "%s", log_msg->str);
>      g_string_free(log_msg, TRUE);
>  
>      if (abort_level != -1 && abort_level >= (int) log_level) {
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]