1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
6 #include "base/i2-base.hpp"
7 #include "base/streamlogger-ti.hpp"
8 #include "base/timer.hpp"
15 * A logger that logs to an iostream.
19 class StreamLogger : public ObjectImpl<StreamLogger>
22 DECLARE_OBJECT(StreamLogger);
24 void Stop(bool runtimeRemoved) override;
25 ~StreamLogger() override;
27 void BindStream(std::ostream *stream, bool ownsStream);
29 static void ProcessLogEntry(std::ostream& stream, const LogEntry& entry);
32 void ProcessLogEntry(const LogEntry& entry) final;
36 static boost::mutex m_Mutex;
37 std::ostream *m_Stream{nullptr};
38 bool m_OwnsStream{false};
40 Timer::Ptr m_FlushLogTimer;
42 void FlushLogTimerHandler();
47 #endif /* STREAMLOGGER_H */