summaryrefslogtreecommitdiff
path: root/tools/standalone_miri/debug.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2018-02-16 20:51:04 +0800
committerJohn Hodge <tpg@mutabah.net>2018-02-16 20:51:04 +0800
commit75413b30fcf5dd97ddf44daa90fe1e361098d9e0 (patch)
tree18dbe1eb09bf0491194255813134b33814d82ac3 /tools/standalone_miri/debug.cpp
parent97156f41a6831d0bfb8870a3757a2b19cd4d2495 (diff)
downloadmrust-75413b30fcf5dd97ddf44daa90fe1e361098d9e0.tar.gz
Standalone MIRI - Hacking along, hit a blocker that will need some refactor.
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