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 + } 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) { -- 2.9.4 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel