added new helper methods/classes (e.g. for heading) new test cases optimize the dijkstra cleanups/refactoring added timed-benchmarks to the log many more...
45 lines
772 B
C++
45 lines
772 B
C++
#ifndef DEBUG_H
|
|
#define DEBUG_H
|
|
|
|
#include <string>
|
|
#include <iostream>
|
|
#include <iomanip>
|
|
#include "Time.h"
|
|
|
|
class Log {
|
|
|
|
public:
|
|
|
|
|
|
|
|
static void add(const char* comp, const std::string what) {
|
|
addComp(comp);
|
|
std::cout << what;
|
|
addTime();
|
|
std::cout << std::endl;
|
|
}
|
|
|
|
static void add(const std::string& component, const std::string what) {
|
|
addComp(component.c_str());
|
|
std::cout << what;
|
|
addTime();
|
|
std::cout << std::endl;
|
|
}
|
|
|
|
private:
|
|
|
|
static void addTime() {
|
|
static auto last = Time::tick();
|
|
const auto cur = Time::tick();
|
|
std::cout << " (+" << Time::diffMS(last, cur) << "ms)";
|
|
last = cur;
|
|
}
|
|
|
|
static void addComp(const char* component) {
|
|
std::cout << "[" << std::setw(12) << std::setfill(' ') << component << "] ";
|
|
}
|
|
|
|
};
|
|
|
|
#endif // DEBUG_H
|