62 void write(
const std::string &data);
70 using Message = std::initializer_list<const char *>;
135 template <ldap_log_level level, const
char *prefix>
137 std::stringstream log_stream;
139 log_stream << prefix <<
" : ";
140 for (
auto &msg_element : msg) {
141 if (msg_element) log_stream << msg_element;
152#define log_dbg(...) Ldap_logger::log_dbg_msg({__VA_ARGS__})
153#define log_info(...) Ldap_logger::log_info_msg({__VA_ARGS__})
154#define log_warning(...) Ldap_logger::log_warning_msg({__VA_ARGS__})
155#define log_error(...) Ldap_logger::log_error_msg({__VA_ARGS__})
Log writer class.
Definition: log_client.h:47
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:68
static void log_dbg_msg(Message msg)
Log a debug message.
Definition: log_client.cc:60
static void log_error_msg(Message msg)
Log an error message.
Definition: log_client.cc:74
void log(Message msg)
Compose the log message and write it.
Definition: log_client.h:136
static void log_info_msg(Message msg)
Log an info message.
Definition: log_client.cc:64
static void create_logger(ldap_log_level log_level=LDAP_LOG_LEVEL_NONE)
Creates the logger object.
Definition: log_client.cc:34
~Ldap_logger()
Destructor.
Definition: log_client.cc:49
ldap_log_level m_log_level
Log level.
Definition: log_client.h:123
static void destroy_logger()
Destroys the logger object.
Definition: log_client.cc:37
std::initializer_list< const char * > Message
type of message to be logged
Definition: log_client.h:70
static Ldap_logger * m_logger
Pointer to the only log object.
Definition: log_client.h:125
Ldap_logger(ldap_log_level level)
Private constructor to assure singleton pattern.
Definition: log_client.cc:44
Ldap_log_writer_error * m_log_writer
Log writer.
Definition: log_client.h:121
static void log_warning_msg(Message msg)
Log a warning message.
Definition: log_client.cc:69
Definition: auth_ldap_kerberos.cc:30
ldap_log_level
LDAP plugin log levels type.
Definition: log_client.h:36
@ LDAP_LOG_LEVEL_NONE
Definition: log_client.h:37
@ LDAP_LOG_LEVEL_ERROR_WARNING
Definition: log_client.h:39
@ LDAP_LOG_LEVEL_ALL
Definition: log_client.h:41
@ LDAP_LOG_LEVEL_ERROR
Definition: log_client.h:38
@ LDAP_LOG_LEVEL_ERROR_WARNING_INFO
Definition: log_client.h:40
static loglevel log_level(const Sql_condition *condition)
Definition: histogram.cc:1643