7 #ifndef _RAVELIN_LOG_H_
8 #define _RAVELIN_LOG_H_
15 #include <boost/shared_ptr.hpp>
20 #define FILE_LOG(level) if (false) Log<OutputToFile>().get(level)
21 #define LOGGING(level) false
23 #define FILE_LOG(level) if ((level & Log<OutputToFile>::reporting_level) > 0) Log<OutputToFile>().get(level)
24 #define LOGGING(level) ((level & Log<OutputToFile>::reporting_level) > 0)
29 static std::ofstream stream;
31 static void output(
const std::string& msg);
34 template <
typename OutputPolicy>
39 std::ostringstream&
get(
unsigned level = 0)
43 tm* ptm = std::gmtime(&rawtime);
44 os <<
"- " << ptm->tm_hour <<
":" << ptm->tm_min <<
":" << ptm->tm_sec;
45 os <<
" " << level <<
": ";
46 message_level = level;
52 if ((message_level & reporting_level) > 0)
53 OutputPolicy::output(os.str());
56 static unsigned reporting_level;
59 std::ostringstream os;
60 unsigned message_level;