summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Nagy <mnagy@redhat.com>2009-07-31 14:18:01 +0200
committerMartin Nagy <mnagy@redhat.com>2009-08-04 16:50:53 +0200
commit785f7db919cc65e5d62800ef77d1d1d39f1c9088 (patch)
treef80d664db22b4981abf31e477aef94fd2db4d9d6
parenta77e1f3abb2e8afbeb2f727f39eb784bff070b45 (diff)
downloadldap_driver-785f7db919cc65e5d62800ef77d1d1d39f1c9088.tar.gz
ldap_driver-785f7db919cc65e5d62800ef77d1d1d39f1c9088.tar.xz
ldap_driver-785f7db919cc65e5d62800ef77d1d1d39f1c9088.zip
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.
-rw-r--r--src/log.h6
1 files changed, 6 insertions, 0 deletions
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);