From 785f7db919cc65e5d62800ef77d1d1d39f1c9088 Mon Sep 17 00:00:00 2001 From: Martin Nagy Date: Fri, 31 Jul 2009 14:18:01 +0200 Subject: Introduce macros log_bug() and log_error_r() The log_bug() is to be used when a condition that should never happen occurs. The log_error_r() will also log the reason of failure, which it will derive from variable 'result' that must be defined and of type isc_result_t. --- src/log.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/log.h b/src/log.h index 6aa9931..0282419 100644 --- a/src/log.h +++ b/src/log.h @@ -25,6 +25,12 @@ #define fatal_error(...) \ isc_error_fatal(__FILE__, __LINE__, __VA_ARGS__) +#define log_bug(fmt, ...) \ + log_error("bug in %s(): " fmt, __func__,##__VA_ARGS__) + +#define log_error_r(fmt, ...) \ + log_error(fmt ": %s", ##__VA_ARGS__, isc_result_totext(result)) + /* Basic logging functions */ void log_debug(int level, const char *format, ...) ISC_FORMAT_PRINTF(2, 3); void log_error(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); -- cgit