mirror of https://github.com/Icinga/icinga2.git
parent
65cf21bc84
commit
a5d25871a1
|
@ -20,7 +20,7 @@
|
||||||
#include "base/application.hpp"
|
#include "base/application.hpp"
|
||||||
#include "base/stacktrace.hpp"
|
#include "base/stacktrace.hpp"
|
||||||
#include "base/timer.hpp"
|
#include "base/timer.hpp"
|
||||||
#include "base/logger_fwd.hpp"
|
#include "base/logger.hpp"
|
||||||
#include "base/exception.hpp"
|
#include "base/exception.hpp"
|
||||||
#include "base/objectlock.hpp"
|
#include "base/objectlock.hpp"
|
||||||
#include "base/utility.hpp"
|
#include "base/utility.hpp"
|
||||||
|
@ -115,6 +115,11 @@ Application::~Application(void)
|
||||||
void Application::Exit(int rc)
|
void Application::Exit(int rc)
|
||||||
{
|
{
|
||||||
std::cout.flush();
|
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.
|
_exit(rc); // Yay, our static destructors are pretty much beyond repair at this point.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,8 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void ProcessLogEntry(const LogEntry& entry) = 0;
|
virtual void ProcessLogEntry(const LogEntry& entry) = 0;
|
||||||
|
|
||||||
|
virtual void Flush(void) = 0;
|
||||||
|
|
||||||
static std::set<Logger::Ptr> GetLoggers(void);
|
static std::set<Logger::Ptr> GetLoggers(void);
|
||||||
|
|
||||||
static void DisableConsoleLog(void);
|
static void DisableConsoleLog(void);
|
||||||
|
|
|
@ -60,7 +60,13 @@ StreamLogger::~StreamLogger(void)
|
||||||
|
|
||||||
void StreamLogger::FlushLogTimerHandler(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)
|
void StreamLogger::BindStream(std::ostream *stream, bool ownsStream)
|
||||||
|
|
|
@ -49,6 +49,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ProcessLogEntry(const LogEntry& entry);
|
virtual void ProcessLogEntry(const LogEntry& entry);
|
||||||
|
virtual void Flush(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static boost::mutex m_Mutex;
|
static boost::mutex m_Mutex;
|
||||||
|
|
|
@ -70,4 +70,9 @@ void SyslogLogger::ProcessLogEntry(const LogEntry& entry)
|
||||||
|
|
||||||
syslog(severity | LOG_USER, "%s", entry.Message.CStr());
|
syslog(severity | LOG_USER, "%s", entry.Message.CStr());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SyslogLogger::Flush(void)
|
||||||
|
{
|
||||||
|
/* Nothing to do here. */
|
||||||
|
}
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
|
@ -42,6 +42,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void ProcessLogEntry(const LogEntry& entry);
|
virtual void ProcessLogEntry(const LogEntry& entry);
|
||||||
|
virtual void Flush(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue