Support --enable-debug-logs=no option of configure script (#2)

* Support --enable-debug-logs=no option of configure script

* Undo unintended white space changes

* Undo more unintended white space changes

* Address review comments - thanks Mirko

* Address more review comments - thanks Mirko
This commit is contained in:
michaelgranzow-avi
2017-08-03 19:50:43 +02:00
committed by Felipe Zimmerle
parent 1d3c4c670d
commit 3a048ee2db
22 changed files with 305 additions and 4 deletions

View File

@@ -282,10 +282,12 @@ 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 `" +
std::to_string(transaction->m_httpCodeReturned) + "'" \
" is not interesting to audit logs, relevant code(s): `" +
m_relevant + "'.");
#endif
return false;
}
@@ -293,15 +295,21 @@ bool AuditLog::saveIfRelevant(Transaction *transaction, int parts) {
if (parts == -1) {
parts = m_parts;
}
#ifndef NO_LOGS
transaction->debug(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
} 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
return false;
}
}

View File

@@ -47,7 +47,9 @@ bool Https::init(std::string *error) {
bool Https::write(Transaction *transaction, int parts, std::string *error) {
Utils::HttpsClient m_http_client;
#ifndef NO_LOGS
transaction->debug(7, "Sending logs to: " + m_audit->m_path1);
#endif
std::string log = transaction->toJSON(parts);
m_http_client.setRequestType("application/json");