]> granicus.if.org Git - icinga2/blob - lib/base/sysloglogger.hpp
Merge pull request #7002 from Icinga/bugfix/check_network-percent-6155
[icinga2] / lib / base / sysloglogger.hpp
1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
2
3 #ifndef SYSLOGLOGGER_H
4 #define SYSLOGLOGGER_H
5
6 #ifndef _WIN32
7 #include "base/i2-base.hpp"
8 #include "base/sysloglogger-ti.hpp"
9
10 namespace icinga
11 {
12
13 /**
14  * A logger that logs to syslog.
15  *
16  * @ingroup base
17  */
18 class SyslogLogger final : public ObjectImpl<SyslogLogger>
19 {
20 public:
21         DECLARE_OBJECT(SyslogLogger);
22         DECLARE_OBJECTNAME(SyslogLogger);
23
24         static void StaticInitialize();
25         static void StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata);
26
27         void OnConfigLoaded() override;
28         void ValidateFacility(const Lazy<String>& lvalue, const ValidationUtils& utils) override;
29
30 protected:
31         static std::map<String, int> m_FacilityMap;
32         int m_Facility;
33
34         void ProcessLogEntry(const LogEntry& entry) override;
35         void Flush() override;
36 };
37
38 }
39 #endif /* _WIN32 */
40
41 #endif /* SYSLOGLOGGER_H */