diff options
author | Simo Sorce <ssorce@redhat.com> | 2010-10-06 17:22:43 -0400 |
---|---|---|
committer | Simo Sorce <ssorce@redhat.com> | 2010-10-07 11:23:51 -0400 |
commit | 016f889a514b6f99d89c7fef9b9cd809fe2fbed5 (patch) | |
tree | dd17aa1f0eff5916c00e8a136ccc6772742a84f3 /daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd.h | |
parent | ec33e38e9a44afcce8bb40043ccf1615f4f3b3fa (diff) | |
download | freeipa-016f889a514b6f99d89c7fef9b9cd809fe2fbed5.tar.gz freeipa-016f889a514b6f99d89c7fef9b9cd809fe2fbed5.tar.xz freeipa-016f889a514b6f99d89c7fef9b9cd809fe2fbed5.zip |
Improve logging facilities
Provide simplified logging macros that appropriately use __func__ __FILE__,
__LINE__, or the plugin name depending on the log level.
Diffstat (limited to 'daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd.h')
-rw-r--r-- | daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd.h b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd.h index 0388f5d43..cba485256 100644 --- a/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd.h +++ b/daemons/ipa-slapi-plugins/ipa-pwd-extop/ipapwd.h @@ -64,6 +64,32 @@ #define IPAPWD_FEATURE_DESC "IPA Password Manager" #define IPAPWD_PLUGIN_DESC "IPA Password Extended Operation plugin" +#ifndef discard_const +#define discard_const(ptr) ((void *)((uintptr_t)(ptr))) +#endif + +#define log_func discard_const(__func__) + +#define LOG(fmt, ...) \ + do { \ + slapi_log_error(SLAPI_LOG_PLUGIN, IPAPWD_PLUGIN_NAME, \ + fmt, ##__VA_ARGS__); \ + } while (0) + +#define LOG_FATAL(fmt, ...) \ + do { \ + slapi_log_error(SLAPI_LOG_PLUGIN, log_func, \ + "[file %s, line %d]: " fmt, \ + __FILE__, __LINE__, ##__VA_ARGS__); \ + } while (0) + +#define LOG_TRACE(fmt, ...) \ + do { \ + slapi_log_error(SLAPI_LOG_PLUGIN, log_func, fmt, ##__VA_ARGS__); \ + } while (0) + +#define LOG_OOM() LOG_FATAL("Out of Memory!\n") + #define IPAPWD_CHECK_CONN_SECURE 0x00000001 #define IPAPWD_CHECK_DN 0x00000002 |