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);
35 template <
typename OutputPolicy>
42 std::cerr <<
"Log() warning: this class is not thread-safe!" << std::endl;
46 std::ostringstream&
get(
unsigned level = 0)
50 tm* ptm = std::gmtime(&rawtime);
51 os <<
"- " << ptm->tm_hour <<
":" << ptm->tm_min <<
":" << ptm->tm_sec;
52 os <<
" " << level <<
": ";
53 message_level = level;
59 if ((message_level & reporting_level) > 0)
60 OutputPolicy::output(os.str());
63 static unsigned reporting_level;
66 std::ostringstream os;
67 unsigned message_level;
Moby's logging utility.
Definition: Log.h:36