Added structured logging

This commit is contained in:
Daniel Wolf
2016-03-01 21:57:05 +01:00
parent cdffb56613
commit 04ca644cca
7 changed files with 40 additions and 7 deletions

View File

@@ -1,4 +1,5 @@
#include "mouthAnimation.h"
#include "logging.h"
using std::map;
@@ -69,12 +70,18 @@ Shape getShape(Phone phone) {
map<centiseconds, Shape> animate(const map<centiseconds, Phone> &phones) {
map<centiseconds, Shape> shapes;
Shape lastShape = Shape::Invalid;
for (auto it = phones.cbegin(); it != phones.cend(); it++) {
for (auto it = phones.cbegin(); it != phones.cend(); ++it) {
Shape shape = getShape(it->second);
if (shape != lastShape || next(it) == phones.cend()) {
shapes[it->first] = shape;
lastShape = shape;
}
}
for (auto it = shapes.cbegin(); it != shapes.cend(); ++it) {
if (next(it) == shapes.cend()) break;
logTimedEvent("shape", it->first, next(it)->first, shapeToString(it->second));
}
return shapes;
}