mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 11:44:32 +03:00
Changes debuglogs schema to avoid unecessary str allocation
This commit is contained in:
@@ -292,9 +292,7 @@ bool AuditLog::saveIfRelevant(Transaction *transaction) {
|
||||
bool AuditLog::saveIfRelevant(Transaction *transaction, int parts) {
|
||||
bool saveAnyway = false;
|
||||
if (m_status == OffAuditLogStatus || m_status == NotSetLogStatus) {
|
||||
#ifndef NO_LOGS
|
||||
transaction->debug(5, "Audit log engine was not set.");
|
||||
#endif
|
||||
ms_dbg_a(transaction, 5, "Audit log engine was not set.");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -308,12 +306,10 @@ bool AuditLog::saveIfRelevant(Transaction *transaction, int parts) {
|
||||
if ((m_status == RelevantOnlyAuditLogStatus
|
||||
&& this->isRelevant(transaction->m_httpCodeReturned) == false)
|
||||
&& saveAnyway == false) {
|
||||
#ifndef NO_LOGS
|
||||
transaction->debug(9, "Return code `" +
|
||||
ms_dbg_a(transaction, 9, "Return code `" +
|
||||
std::to_string(transaction->m_httpCodeReturned) + "'" \
|
||||
" is not interesting to audit logs, relevant code(s): `" +
|
||||
m_relevant + "'.");
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -321,21 +317,15 @@ bool AuditLog::saveIfRelevant(Transaction *transaction, int parts) {
|
||||
if (parts == -1) {
|
||||
parts = m_parts;
|
||||
}
|
||||
#ifndef NO_LOGS
|
||||
transaction->debug(5, "Saving this request as part " \
|
||||
ms_dbg_a(transaction, 5, "Saving this request as part " \
|
||||
"of the audit logs.");
|
||||
#endif
|
||||
if (m_writer == NULL) {
|
||||
#ifndef NO_LOGS
|
||||
transaction->debug(1, "Internal error, audit log writer is null");
|
||||
#endif
|
||||
ms_dbg_a(transaction, 1, "Internal error, audit log writer is null");
|
||||
} else {
|
||||
std::string error;
|
||||
bool a = m_writer->write(transaction, parts, &error);
|
||||
if (a == false) {
|
||||
#ifndef NO_LOGS
|
||||
transaction->debug(1, "Cannot save the audit log: " + error);
|
||||
#endif
|
||||
ms_dbg_a(transaction, 1, "Cannot save the audit log: " + error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user