X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FLog.cc;fp=src%2FMoof%2FLog.cc;h=0000000000000000000000000000000000000000;hp=da7985d60115bff1bde22cc9557131f7059c6742;hb=831f04d4bc19a390415ac0bbac4331c7a65509bc;hpb=299af4f2047e767e5d79501c26444473bda64c64 diff --git a/src/Moof/Log.cc b/src/Moof/Log.cc deleted file mode 100644 index da7985d..0000000 --- a/src/Moof/Log.cc +++ /dev/null @@ -1,75 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#include - -#include "Log.hh" -#include "Script.hh" - - -namespace Mf { - - -Log::Level Log::gLevel = Log::INFO; - - -void Log::setLevel(Level level) -{ - gLevel = level; -} - -Log::Level Log::level() -{ - return gLevel; -} - - -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: "); - - -static int logScript_(Script& script, Log::Level level) -{ - static Log* logs[] = {0, &logError, &logWarning, &logInfo}; - - Script::Slot param = script[1]; - - while (!param.isNone()) - { - (*logs[level])(param); - ++param.index; - } - - return 0; -} - - -void importLogFunctions(Script& script) -{ - 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)); -} - - -} // namespace Mf -