]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Log.cc
cleaned up interpolator classes
[chaz/yoink] / src / Moof / Log.cc
index 2ea6c57533875b808c58c01e97e3a6205fd12737..863ab87317c6cc9f2e7235877a1fa7d0818c8147 100644 (file)
 namespace Mf {
 
 
-Log::Level Log::gLevel = Log::WARNING;
+Log::Level Log::gLevel = Log::INFO;
 
 
 void Log::setLevel(Level level)
 {
-       if (level != 0) gLevel = level;
+       gLevel = level;
 }
 
 Log::Level Log::getLevel()
@@ -49,26 +49,25 @@ Log::Level Log::getLevel()
 }
 
 
-static std::ofstream nullLog_;
-
 std::ostream& log(std::clog);
+
+static std::ofstream nullLog_;
 std::ostream& nullLog(nullLog_);
 
 Log logError(Log::ERRORR, "  error: ");
 Log logWarning(Log::WARNING, "warning: ");
 Log logInfo(Log::INFO, "   info: ");
-Log logDebug(Log::DEBUGG, "  debug: ");
 
 
-static int logScript_(Script& script)
+static int logScript_(Script& script, Log::Level level)
 {
-       static Log logScript(Log::SCRIPT, " script: ");
+       static Log* logs[] = {0, &logError, &logWarning, &logInfo};
 
        Script::Slot param = script[1];
 
        while (!param.isNone())
        {
-               logScript(param);
+               (*logs[level])(param);
                ++param.index;
        }
 
@@ -76,9 +75,12 @@ static int logScript_(Script& script)
 }
 
 
-void importLogPrintFunction(Script& script)
+void importLogFunctions(Script& script)
 {
-       script.importFunction("print", logScript_);
+       script.importFunction("LogError",   boost::bind(logScript_, _1, Log::ERRORR));
+       script.importFunction("LogWarning", boost::bind(logScript_, _1, Log::WARNING));
+       script.importFunction("LogInfo",    boost::bind(logScript_, _1, Log::INFO));
+       script.importFunction("print",      boost::bind(logScript_, _1, Log::INFO));
 }
 
 
This page took 0.018778 seconds and 4 git commands to generate.