Files
revng-revng/debug.cpp
T
Alessandro Di Federico 0d58bc3cf7 Introduce logging framework
2016-01-12 22:43:04 +01:00

32 lines
771 B
C++

// Standard includes
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
// Local includes
#include "debug.h"
bool DebuggingEnabled = false;
std::ostream& dbg(std::cerr);
static std::vector<std::string> DebugFeatures;
bool isDebugFeatureEnabled(std::string Name) {
return std::find(DebugFeatures.begin(),
DebugFeatures.end(),
Name) != DebugFeatures.end();
}
void enableDebugFeature(std::string Name) {
if (!isDebugFeatureEnabled(Name))
DebugFeatures.push_back(Name);
}
void disableDebugFeature(std::string Name) {
auto It = std::find(DebugFeatures.begin(),
DebugFeatures.end(),
Name);
if (It != DebugFeatures.end())
DebugFeatures.erase(It);
}