61 void write(
const std::string &data);
69 using Message = std::initializer_list<const char *>;
134 template <ldap_log_level level, const
char *prefix>
136 std::stringstream log_stream;
138 log_stream << prefix <<
" : ";
139 for (
auto &msg_element : msg) {
140 if (msg_element) log_stream << msg_element;
151#define log_dbg(...) Ldap_logger::log_dbg_msg({__VA_ARGS__})
152#define log_info(...) Ldap_logger::log_info_msg({__VA_ARGS__})
153#define log_warning(...) Ldap_logger::log_warning_msg({__VA_ARGS__})
154#define log_error(...) Ldap_logger::log_error_msg({__VA_ARGS__})
Log writer class.
Definition: log_client.h:46
void write(const std::string &data)
Writes the data to the log.
Definition: log_client.cc:79
~Ldap_log_writer_error()
Destructor.
Ldap_log_writer_error()
Constructor.
Class representing logger for LDAP plugins.
Definition: log_client.h:67
static void log_dbg_msg(Message msg)
Log a debug message.
Definition: log_client.cc:59
static void log_error_msg(Message msg)
Log an error message.
Definition: log_client.cc:73
void log(Message msg)
Compose the log message and write it.
Definition: log_client.h:135
static void log_info_msg(Message msg)
Log an info message.
Definition: log_client.cc:63
static void create_logger(ldap_log_level log_level=LDAP_LOG_LEVEL_NONE)
Creates the logger object.
Definition: log_client.cc:33
~Ldap_logger()
Destructor.
Definition: log_client.cc:48
ldap_log_level m_log_level
Log level.
Definition: log_client.h:122
static void destroy_logger()
Destroys the logger object.
Definition: log_client.cc:36
std::initializer_list< const char * > Message
type of message to be logged
Definition: log_client.h:69
static Ldap_logger * m_logger
Pointer to the only log object.
Definition: log_client.h:124
Ldap_logger(ldap_log_level level)
Private constructor to assure singleton pattern.
Definition: log_client.cc:43
Ldap_log_writer_error * m_log_writer
Log writer.
Definition: log_client.h:120
static void log_warning_msg(Message msg)
Log a warning message.
Definition: log_client.cc:68
Definition: auth_ldap_kerberos.cc:29
ldap_log_level
LDAP plugin log levels type.
Definition: log_client.h:35
@ LDAP_LOG_LEVEL_NONE
Definition: log_client.h:36
@ LDAP_LOG_LEVEL_ERROR_WARNING
Definition: log_client.h:38
@ LDAP_LOG_LEVEL_ALL
Definition: log_client.h:40
@ LDAP_LOG_LEVEL_ERROR
Definition: log_client.h:37
@ LDAP_LOG_LEVEL_ERROR_WARNING_INFO
Definition: log_client.h:39