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

@@ -50,7 +50,9 @@ bool RuleEngine::evaluate(Rule *rule, Transaction *transaction) {
a << modsecurity::RulesProperties::ruleEngineStateString(m_ruleEngine);
a << " as requested by a ctl:ruleEngine action";
#ifndef NO_LOGS
transaction->debug(8, a.str());
#endif
transaction->m_secRuleEngine = m_ruleEngine;
return true;

View File

@@ -49,9 +49,11 @@ bool Allow::init(std::string *error) {
bool Allow::evaluate(Rule *rule, Transaction *transaction) {
#ifndef NO_LOGS
transaction->debug(4, "Dropping the evaluation of upcoming rules " \
"in favor of an `allow' action of type: " \
+ allowTypeToName(m_allowType));
#endif
transaction->m_allowType = m_allowType;

View File

@@ -32,7 +32,9 @@ namespace disruptive {
bool Block::evaluate(Rule *rule, Transaction *transaction,
std::shared_ptr<RuleMessage> rm) {
#ifndef NO_LOGS
transaction->debug(8, "Marking request as disruptive.");
#endif
for (Action *a : transaction->m_rules->m_defaultActions[rule->m_phase]) {
if (a->isDisruptive() == false) {

View File

@@ -33,7 +33,9 @@ bool Pass::evaluate(Rule *rule, Transaction *transaction,
intervention::free(&transaction->m_it);
intervention::reset(&transaction->m_it);
#ifndef NO_LOGS
transaction->debug(8, "Running action pass");
#endif
return true;
}

View File

@@ -71,8 +71,10 @@ bool InitCol::evaluate(Rule *rule, Transaction *t) {
return false;
}
#ifndef NO_LOGS
t->debug(5, "Collection `" + m_collection_key + "' initialized with " \
"value: " + collectionName);
#endif
return true;
}

View File

@@ -30,7 +30,9 @@ namespace actions {
bool Log::evaluate(Rule *rule, Transaction *transaction,
std::shared_ptr<RuleMessage> rm) {
#ifndef NO_LOGS
transaction->debug(9, "Saving transaction to logs");
#endif
rm->m_saveMessage = true;
return true;
}

View File

@@ -51,7 +51,9 @@ bool Msg::evaluate(Rule *rule, Transaction *transaction,
std::shared_ptr<RuleMessage> rm) {
std::string msg = data(transaction);
rm->m_message = msg;
#ifndef NO_LOGS
transaction->debug(9, "Saving msg: " + msg);
#endif
transaction->m_collections.storeOrUpdateFirst("RULE:msg", msg);