src/Logger.cc
branchnew_graphics
changeset 418 194bc810a570
parent 412 721c60072091
--- a/src/Logger.cc	Thu Jan 22 01:53:05 2009 +0200
+++ b/src/Logger.cc	Thu Jan 22 02:38:33 2009 +0200
@@ -1,8 +1,8 @@
 
 #include "Logger.hh"
 
-Logger::Logger (std::ostream &stream, enum LogLevel level, const char *module) : 
-    stream(stream), level(level), module(module) 
+Logger::Logger (std::ostream &stream, LogLevel level, const char *module, LogLevel max_level) : 
+    stream(stream), show(level <= max_level)
 {
     const char *l;
 
@@ -14,15 +14,13 @@
         case DEBUG: l = "DEBUG"; break;
         default: l = "???"; break;
     };
-
-#ifndef NDEBUG    
-    stream << l << " [" << module << "] ";
-#endif
+    
+    if (show)
+        stream << l << " [" << module << "] ";
 }
 
 Logger::~Logger (void) {
-#ifndef NDEBUG    
-    stream << std::endl;
-#endif
+    if (show)
+        stream << std::endl;
 }