summaryrefslogtreecommitdiff
path: root/debug.cc
diff options
context:
space:
mode:
Diffstat (limited to 'debug.cc')
-rw-r--r--debug.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/debug.cc b/debug.cc
new file mode 100644
index 00000000..428d5a4d
--- /dev/null
+++ b/debug.cc
@@ -0,0 +1,23 @@
+#include "debug.h"
+
+#ifdef DEBUG_ENABLED
+
+namespace ledger {
+
+std::ostream * debug_stream = &std::cerr;
+bool free_debug_stream = false;
+
+static class free_streams
+{
+ public:
+ ~free_streams() {
+ if (free_debug_stream && debug_stream) {
+ delete debug_stream;
+ debug_stream = NULL;
+ }
+ }
+} _debug_cleanup;
+
+} // namespace ledger
+
+#endif DEBUG_ENABLED