Common include file for SLAPI plugin logging

Consolidate the common logging macros into common/util.h and use them
in SLAPI plugins instead of calling slapi_log_error() directly.

https://fedorahosted.org/freeipa/ticket/408

Signed-off-by: Simo Sorce <ssorce@redhat.com>
This commit is contained in:
Jakub Hrozek authored and Simo Sorce committed 2010-11-22 16:01:35 -05:00
1 parent b9f539ba19
commit 5da451876e
19 files changed
+332 -449

No files matched your search

@@ -1,8 +1,11 @@
NULL =
PLUGIN_COMMON_DIR=../common
INCLUDES = \
-I. \
-I$(srcdir) \
-I$(PLUGIN_COMMON_DIR) \
-DPREFIX=\""$(prefix)"\" \
-DBINDIR=\""$(bindir)"\" \
-DLIBDIR=\""$(libdir)"\" \
@@ -38,6 +38,7 @@
* END COPYRIGHT BLOCK **/
#include "ipapwd.h"
#include "util.h"
/*
* Password Modify - LDAP Extended Operation.
@@ -64,26 +64,7 @@
#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, ...) \
slapi_log_error(SLAPI_LOG_PLUGIN, \
IPAPWD_PLUGIN_NAME, \
fmt, ##__VA_ARGS__)
#define LOG_FATAL(fmt, ...) \
slapi_log_error(SLAPI_LOG_FATAL, log_func, \
"[file %s, line %d]: " fmt, \
__FILE__, __LINE__, ##__VA_ARGS__)
#define LOG_TRACE(fmt, ...) \
slapi_log_error(SLAPI_LOG_TRACE, log_func, fmt, ##__VA_ARGS__)
#define LOG_OOM() LOG_FATAL("Out of Memory!\n")
#define IPA_PLUGIN_NAME IPAPWD_PLUGIN_NAME
#define IPAPWD_CHECK_CONN_SECURE 0x00000001
#define IPAPWD_CHECK_DN 0x00000002
@@ -38,6 +38,7 @@
* END COPYRIGHT BLOCK **/
#include "ipapwd.h"
#include "util.h"
/* Type of connection for this operation;*/
#define LDAP_EXTOP_PASSMOD_CONN_SECURE
@@ -53,6 +53,7 @@
#include <time.h>
#include "ipapwd.h"
#include "util.h"
/* krbTicketFlags */
#define KTF_DISALLOW_POSTDATED 0x00000001
@@ -53,6 +53,7 @@
#include <time.h>
#include "ipapwd.h"
#include "util.h"
#define IPAPWD_OP_NULL 0
#define IPAPWD_OP_ADD 1