summaryrefslogtreecommitdiff
path: root/tools/standalone_miri/debug.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/standalone_miri/debug.cpp')
-rw-r--r--tools/standalone_miri/debug.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/tools/standalone_miri/debug.cpp b/tools/standalone_miri/debug.cpp
new file mode 100644
index 00000000..503d775a
--- /dev/null
+++ b/tools/standalone_miri/debug.cpp
@@ -0,0 +1,42 @@
+#include "debug.hpp"
+
+DebugSink::DebugSink(::std::ostream& inner):
+ m_inner(inner)
+{
+}
+DebugSink::~DebugSink()
+{
+ m_inner << "\n";
+}
+bool DebugSink::enabled(const char* fcn_name)
+{
+ return true;
+}
+DebugSink DebugSink::get(const char* fcn_name, const char* file, unsigned line, DebugLevel lvl)
+{
+ switch(lvl)
+ {
+ case DebugLevel::Trace:
+ ::std::cout << "Trace: " << file << ":" << line << ": ";
+ break;
+ case DebugLevel::Debug:
+ ::std::cout << "DEBUG: " << fcn_name << ": ";
+ break;
+ case DebugLevel::Notice:
+ ::std::cout << "NOTE: ";
+ break;
+ case DebugLevel::Warn:
+ ::std::cout << "WARN: ";
+ break;
+ case DebugLevel::Error:
+ ::std::cout << "ERROR: ";
+ break;
+ case DebugLevel::Fatal:
+ ::std::cout << "FATAL: ";
+ break;
+ case DebugLevel::Bug:
+ ::std::cout << "BUG: " << fcn_name << ": ";
+ break;
+ }
+ return DebugSink(::std::cout);
+} \ No newline at end of file