Reduced log duplicity.

This commit is contained in:
Thulinma 2013-10-29 16:52:05 +01:00
parent c9e42afe85
commit 8cae22be8e

View file

@ -14,10 +14,16 @@ namespace Controller {
void Log(std::string kind, std::string message){ void Log(std::string kind, std::string message){
//if last log message equals this one, do not log. //if last log message equals this one, do not log.
if (Storage["log"].size() > 0){ if (Storage["log"].size() > 0){
JSON::ArrIter it = Storage["log"].ArrEnd() - 1; JSON::ArrIter it = Storage["log"].ArrEnd();
if (( *it)[2] == message && ( *it)[1] == kind){ int repeats = Storage["log"].size();
return; if (repeats > 10){repeats = 10;}
} do{
it--;
if (( *it)[2] == message && ( *it)[1] == kind){
return;
}
repeats--;
}while (repeats > 0);
} }
JSON::Value m; JSON::Value m;
m.append(Util::epoch()); m.append(Util::epoch());