[Spice-devel] [RFC PATCH] log: warn on spice_return*_if_fail instead of aborting
Uri Lublin
uril at redhat.com
Mon Oct 29 02:46:56 PDT 2012
Currently log level for spice_return_if_fail and spice_return_val_if_failed
functions (#define macros really) is SPICE_LOG_LEVEL_CRITICAL.
By default spice abort level is SPICE_LOG_LEVEL_CRITICAL.
That means the program aborts upon a call to spice_return_if_fail
functions.
This patch changes the log level for spice_return_if_fail functions
to SPICE_LOG_LEVEL_WARNING, such that a warning message
is written to log, and the program continues.
---
common/log.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/common/log.h b/common/log.h
index d9e6023..60a64de 100644
--- a/common/log.h
+++ b/common/log.h
@@ -58,7 +58,7 @@ void spice_log(const char *log_domain,
#ifndef spice_return_if_fail
#define spice_return_if_fail(x) SPICE_STMT_START { \
if SPICE_LIKELY(x) { } else { \
- spice_log(SPICE_LOG_DOMAIN, SPICE_LOG_LEVEL_CRITICAL, SPICE_STRLOC, __FUNCTION__, "condition `%s' failed", #x); \
+ spice_log(SPICE_LOG_DOMAIN, SPICE_LOG_LEVEL_WARNING, SPICE_STRLOC, __FUNCTION__, "condition `%s' failed", #x); \
return; \
} \
} SPICE_STMT_END
@@ -67,7 +67,7 @@ void spice_log(const char *log_domain,
#ifndef spice_return_val_if_fail
#define spice_return_val_if_fail(x, val) SPICE_STMT_START { \
if SPICE_LIKELY(x) { } else { \
- spice_log(SPICE_LOG_DOMAIN, SPICE_LOG_LEVEL_CRITICAL, SPICE_STRLOC, __FUNCTION__, "condition `%s' failed", #x); \
+ spice_log(SPICE_LOG_DOMAIN, SPICE_LOG_LEVEL_WARNING, SPICE_STRLOC, __FUNCTION__, "condition `%s' failed", #x); \
return (val); \
} \
} SPICE_STMT_END
--
1.7.1
More information about the Spice-devel
mailing list