Adds support for the server log integration

This commit is contained in:
Felipe Zimmerle
2015-09-17 09:01:52 -03:00
parent 5228b685bf
commit d0c215d78b
7 changed files with 48 additions and 11 deletions

View File

@@ -44,7 +44,8 @@ namespace ModSecurity {
* @endcode
*/
ModSecurity::ModSecurity()
: m_connector("") {
: m_connector(""),
m_logCb(NULL) {
UniqueId::uniqueId();
srand(time(NULL));
#ifdef MSC_WITH_CURL
@@ -138,6 +139,23 @@ const std::string& ModSecurity::getConnectorInformation() {
}
void ModSecurity::serverLog(void *data, const std::string& msg) {
if (m_logCb == NULL) {
std::cout << "Server log callback is not set -- " << msg << std::endl;
} else {
m_logCb(data, msg.c_str());
}
}
void ModSecurity::setServerLogCb(LogCb cb) {
m_logCb = (LogCb) cb;
}
extern "C" void msc_set_log_cb(ModSecurity *msc, LogCb cb) {
msc->setServerLogCb(cb);
}
/**
* @name msc_set_connector_info
* @brief Set information about the connector that is using the library.