]>
Dogcows Code - chaz/yoink/blob - src/Moof/Log.cc
8656dc306a4531e4ea928cf3a645364f43708168
2 /*] Copyright (c) 2009-2010, Charles McGarvey [**************************
3 **] All rights reserved.
7 * Distributable under the terms and conditions of the 2-clause BSD license;
8 * see the file COPYING for a complete text of the license.
10 **************************************************************************/
21 Log::Level
Log::gLevel
= Log::INFO
;
24 void Log::setLevel(Level level
)
29 Log::Level
Log::getLevel()
35 std::ostream
& log(std::clog
);
37 static std::ofstream nullLog_
;
38 std::ostream
& nullLog(nullLog_
);
40 Log
logError(Log::ERRORR
, " error: ");
41 Log
logWarning(Log::WARNING
, "warning: ");
42 Log
logInfo(Log::INFO
, " info: ");
45 static int logScript_(Script
& script
, Log::Level level
)
47 static Log
* logs
[] = {0, &logError
, &logWarning
, &logInfo
};
49 Script::Slot param
= script
[1];
51 while (!param
.isNone())
53 (*logs
[level
])(param
);
61 void importLogFunctions(Script
& script
)
63 script
.importFunction("LogError",
64 boost::bind(logScript_
, _1
, Log::ERRORR
));
65 script
.importFunction("LogWarning",
66 boost::bind(logScript_
, _1
, Log::WARNING
));
67 script
.importFunction("LogInfo",
68 boost::bind(logScript_
, _1
, Log::INFO
));
69 script
.importFunction("print",
70 boost::bind(logScript_
, _1
, Log::INFO
));
This page took 0.037262 seconds and 4 git commands to generate.