2019-02-25 14:48:22 +01:00
|
|
|
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
|
2012-09-17 13:35:55 +02:00
|
|
|
|
2012-07-10 13:31:17 +02:00
|
|
|
#ifndef SYSLOGLOGGER_H
|
|
|
|
#define SYSLOGLOGGER_H
|
|
|
|
|
2014-11-07 18:37:07 +01:00
|
|
|
#ifndef _WIN32
|
2014-05-25 16:23:35 +02:00
|
|
|
#include "base/i2-base.hpp"
|
2018-01-18 13:50:38 +01:00
|
|
|
#include "base/sysloglogger-ti.hpp"
|
2013-03-16 21:18:53 +01:00
|
|
|
|
2012-07-10 13:31:17 +02:00
|
|
|
namespace icinga
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A logger that logs to syslog.
|
2012-09-17 13:35:55 +02:00
|
|
|
*
|
|
|
|
* @ingroup base
|
2012-07-10 13:31:17 +02:00
|
|
|
*/
|
2018-01-04 06:11:04 +01:00
|
|
|
class SyslogLogger final : public ObjectImpl<SyslogLogger>
|
2012-07-10 13:31:17 +02:00
|
|
|
{
|
|
|
|
public:
|
2014-11-03 00:44:04 +01:00
|
|
|
DECLARE_OBJECT(SyslogLogger);
|
|
|
|
DECLARE_OBJECTNAME(SyslogLogger);
|
2012-07-10 15:14:45 +02:00
|
|
|
|
2018-01-04 04:25:35 +01:00
|
|
|
static void StaticInitialize();
|
2015-02-13 11:28:43 +01:00
|
|
|
static void StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata);
|
2014-02-17 16:34:18 +01:00
|
|
|
|
2018-01-04 05:12:56 +01:00
|
|
|
void OnConfigLoaded() override;
|
2018-01-11 07:08:09 +01:00
|
|
|
void ValidateFacility(const Lazy<String>& lvalue, const ValidationUtils& utils) override;
|
2017-09-19 16:42:32 +02:00
|
|
|
|
2012-07-10 13:31:17 +02:00
|
|
|
protected:
|
2017-09-19 16:42:32 +02:00
|
|
|
static std::map<String, int> m_FacilityMap;
|
|
|
|
int m_Facility;
|
|
|
|
|
2018-01-04 05:12:56 +01:00
|
|
|
void ProcessLogEntry(const LogEntry& entry) override;
|
|
|
|
void Flush() override;
|
2012-07-10 13:31:17 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
2012-07-10 15:44:59 +02:00
|
|
|
#endif /* _WIN32 */
|
2012-07-10 13:31:17 +02:00
|
|
|
|
|
|
|
#endif /* SYSLOGLOGGER_H */
|