#include "base/application.hpp"
#include "base/stacktrace.hpp"
#include "base/timer.hpp"
-#include "base/logger_fwd.hpp"
+#include "base/logger.hpp"
#include "base/exception.hpp"
#include "base/objectlock.hpp"
#include "base/utility.hpp"
void Application::Exit(int rc)
{
std::cout.flush();
+
+ BOOST_FOREACH(const Logger::Ptr& logger, Logger::GetLoggers()) {
+ logger->Flush();
+ }
+
_exit(rc); // Yay, our static destructors are pretty much beyond repair at this point.
}
*/
virtual void ProcessLogEntry(const LogEntry& entry) = 0;
+ virtual void Flush(void) = 0;
+
static std::set<Logger::Ptr> GetLoggers(void);
static void DisableConsoleLog(void);
void StreamLogger::FlushLogTimerHandler(void)
{
- m_Stream->flush();
+ Flush();
+}
+
+void StreamLogger::Flush(void)
+{
+ if (m_Stream)
+ m_Stream->flush();
}
void StreamLogger::BindStream(std::ostream *stream, bool ownsStream)
protected:
virtual void ProcessLogEntry(const LogEntry& entry);
+ virtual void Flush(void);
private:
static boost::mutex m_Mutex;
syslog(severity | LOG_USER, "%s", entry.Message.CStr());
}
+
+void SyslogLogger::Flush(void)
+{
+ /* Nothing to do here. */
+}
#endif /* _WIN32 */
protected:
virtual void ProcessLogEntry(const LogEntry& entry);
+ virtual void Flush(void);
};
}