Rename CompatLog class.

This commit is contained in:
Gunnar Beutner 2013-09-25 10:55:50 +02:00
parent 7f97895965
commit 463cc53dca
4 changed files with 36 additions and 36 deletions

View File

@ -16,8 +16,8 @@ libcompat_la_SOURCES = \
externalcommandlistener.h \ externalcommandlistener.h \
statusdatawriter.cpp \ statusdatawriter.cpp \
statusdatawriter.h \ statusdatawriter.h \
compatlog.cpp \ compatlogger.cpp \
compatlog.h \ compatlogger.h \
compat-type.conf compat-type.conf
libcompat_la_CPPFLAGS = \ libcompat_la_CPPFLAGS = \

View File

@ -26,7 +26,7 @@ type ExternalCommandListener {
%attribute string "command_path" %attribute string "command_path"
} }
type CompatLog { type CompatLogger {
%validator "ValidateRotationMethod", %validator "ValidateRotationMethod",
%attribute string "log_dir", %attribute string "log_dir",

View File

@ -17,7 +17,7 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/ ******************************************************************************/
#include "compat/compatlog.h" #include "compat/compatlogger.h"
#include "icinga/service.h" #include "icinga/service.h"
#include "icinga/checkcommand.h" #include "icinga/checkcommand.h"
#include "icinga/notification.h" #include "icinga/notification.h"
@ -37,28 +37,28 @@
using namespace icinga; using namespace icinga;
REGISTER_TYPE(CompatLog); REGISTER_TYPE(CompatLogger);
REGISTER_SCRIPTFUNCTION(ValidateRotationMethod, &CompatLog::ValidateRotationMethod); REGISTER_SCRIPTFUNCTION(ValidateRotationMethod, &CompatLogger::ValidateRotationMethod);
CompatLog::CompatLog(void) CompatLogger::CompatLogger(void)
: m_LastRotation(0) : m_LastRotation(0)
{ } { }
/** /**
* @threadsafety Always. * @threadsafety Always.
*/ */
void CompatLog::Start(void) void CompatLogger::Start(void)
{ {
DynamicObject::Start(); DynamicObject::Start();
Service::OnNewCheckResult.connect(bind(&CompatLog::CheckResultHandler, this, _1, _2)); Service::OnNewCheckResult.connect(bind(&CompatLogger::CheckResultHandler, this, _1, _2));
Service::OnNotificationSentToUser.connect(bind(&CompatLog::NotificationSentHandler, this, _1, _2, _3, _4, _5, _6)); Service::OnNotificationSentToUser.connect(bind(&CompatLogger::NotificationSentHandler, this, _1, _2, _3, _4, _5, _6));
Service::OnFlappingChanged.connect(bind(&CompatLog::FlappingHandler, this, _1, _2)); Service::OnFlappingChanged.connect(bind(&CompatLogger::FlappingHandler, this, _1, _2));
Service::OnDowntimeTriggered.connect(boost::bind(&CompatLog::TriggerDowntimeHandler, this, _1, _2)); Service::OnDowntimeTriggered.connect(boost::bind(&CompatLogger::TriggerDowntimeHandler, this, _1, _2));
Service::OnDowntimeRemoved.connect(boost::bind(&CompatLog::RemoveDowntimeHandler, this, _1, _2)); Service::OnDowntimeRemoved.connect(boost::bind(&CompatLogger::RemoveDowntimeHandler, this, _1, _2));
m_RotationTimer = boost::make_shared<Timer>(); m_RotationTimer = boost::make_shared<Timer>();
m_RotationTimer->OnTimerExpired.connect(boost::bind(&CompatLog::RotationTimerHandler, this)); m_RotationTimer->OnTimerExpired.connect(boost::bind(&CompatLogger::RotationTimerHandler, this));
m_RotationTimer->Start(); m_RotationTimer->Start();
ReopenFile(false); ReopenFile(false);
@ -68,7 +68,7 @@ void CompatLog::Start(void)
/** /**
* @threadsafety Always. * @threadsafety Always.
*/ */
String CompatLog::GetLogDir(void) const String CompatLogger::GetLogDir(void) const
{ {
if (!m_LogDir.IsEmpty()) if (!m_LogDir.IsEmpty())
return m_LogDir; return m_LogDir;
@ -79,7 +79,7 @@ String CompatLog::GetLogDir(void) const
/** /**
* @threadsafety Always. * @threadsafety Always.
*/ */
String CompatLog::GetRotationMethod(void) const String CompatLogger::GetRotationMethod(void) const
{ {
if (!m_RotationMethod.IsEmpty()) if (!m_RotationMethod.IsEmpty())
return m_RotationMethod; return m_RotationMethod;
@ -90,7 +90,7 @@ String CompatLog::GetRotationMethod(void) const
/** /**
* @threadsafety Always. * @threadsafety Always.
*/ */
void CompatLog::CheckResultHandler(const Service::Ptr& service, const Dictionary::Ptr &cr) void CompatLogger::CheckResultHandler(const Service::Ptr& service, const Dictionary::Ptr &cr)
{ {
Host::Ptr host = service->GetHost(); Host::Ptr host = service->GetHost();
@ -171,7 +171,7 @@ void CompatLog::CheckResultHandler(const Service::Ptr& service, const Dictionary
/** /**
* @threadsafety Always. * @threadsafety Always.
*/ */
void CompatLog::TriggerDowntimeHandler(const Service::Ptr& service, const Dictionary::Ptr& downtime) void CompatLogger::TriggerDowntimeHandler(const Service::Ptr& service, const Dictionary::Ptr& downtime)
{ {
Host::Ptr host = service->GetHost(); Host::Ptr host = service->GetHost();
@ -217,7 +217,7 @@ void CompatLog::TriggerDowntimeHandler(const Service::Ptr& service, const Dictio
/** /**
* @threadsafety Always. * @threadsafety Always.
*/ */
void CompatLog::RemoveDowntimeHandler(const Service::Ptr& service, const Dictionary::Ptr& downtime) void CompatLogger::RemoveDowntimeHandler(const Service::Ptr& service, const Dictionary::Ptr& downtime)
{ {
Host::Ptr host = service->GetHost(); Host::Ptr host = service->GetHost();
@ -274,7 +274,7 @@ void CompatLog::RemoveDowntimeHandler(const Service::Ptr& service, const Diction
/** /**
* @threadsafety Always. * @threadsafety Always.
*/ */
void CompatLog::NotificationSentHandler(const Service::Ptr& service, const User::Ptr& user, void CompatLogger::NotificationSentHandler(const Service::Ptr& service, const User::Ptr& user,
NotificationType const& notification_type, Dictionary::Ptr const& cr, NotificationType const& notification_type, Dictionary::Ptr const& cr,
const String& author, const String& comment_text) const String& author, const String& comment_text)
{ {
@ -351,7 +351,7 @@ void CompatLog::NotificationSentHandler(const Service::Ptr& service, const User:
/** /**
* @threadsafety Always. * @threadsafety Always.
*/ */
void CompatLog::FlappingHandler(const Service::Ptr& service, FlappingState flapping_state) void CompatLogger::FlappingHandler(const Service::Ptr& service, FlappingState flapping_state)
{ {
Host::Ptr host = service->GetHost(); Host::Ptr host = service->GetHost();
@ -413,7 +413,7 @@ void CompatLog::FlappingHandler(const Service::Ptr& service, FlappingState flapp
} }
void CompatLog::WriteLine(const String& line) void CompatLogger::WriteLine(const String& line)
{ {
ASSERT(OwnsLock()); ASSERT(OwnsLock());
@ -423,7 +423,7 @@ void CompatLog::WriteLine(const String& line)
m_OutputFile << "[" << (long)Utility::GetTime() << "] " << line << "\n"; m_OutputFile << "[" << (long)Utility::GetTime() << "] " << line << "\n";
} }
void CompatLog::Flush(void) void CompatLogger::Flush(void)
{ {
ASSERT(OwnsLock()); ASSERT(OwnsLock());
@ -436,7 +436,7 @@ void CompatLog::Flush(void)
/** /**
* @threadsafety Always. * @threadsafety Always.
*/ */
void CompatLog::ReopenFile(bool rotate) void CompatLogger::ReopenFile(bool rotate)
{ {
ObjectLock olock(this); ObjectLock olock(this);
@ -506,7 +506,7 @@ void CompatLog::ReopenFile(bool rotate)
Flush(); Flush();
} }
void CompatLog::ScheduleNextRotation(void) void CompatLogger::ScheduleNextRotation(void)
{ {
time_t now = (time_t)Utility::GetTime(); time_t now = (time_t)Utility::GetTime();
String method = GetRotationMethod(); String method = GetRotationMethod();
@ -558,7 +558,7 @@ void CompatLog::ScheduleNextRotation(void)
/** /**
* @threadsafety Always. * @threadsafety Always.
*/ */
void CompatLog::RotationTimerHandler(void) void CompatLogger::RotationTimerHandler(void)
{ {
try { try {
ReopenFile(true); ReopenFile(true);
@ -571,7 +571,7 @@ void CompatLog::RotationTimerHandler(void)
ScheduleNextRotation(); ScheduleNextRotation();
} }
void CompatLog::ValidateRotationMethod(const String& location, const Dictionary::Ptr& attrs) void CompatLogger::ValidateRotationMethod(const String& location, const Dictionary::Ptr& attrs)
{ {
Value rotation_method = attrs->Get("rotation_method"); Value rotation_method = attrs->Get("rotation_method");
@ -582,7 +582,7 @@ void CompatLog::ValidateRotationMethod(const String& location, const Dictionary:
} }
} }
void CompatLog::InternalSerialize(const Dictionary::Ptr& bag, int attributeTypes) const void CompatLogger::InternalSerialize(const Dictionary::Ptr& bag, int attributeTypes) const
{ {
DynamicObject::InternalSerialize(bag, attributeTypes); DynamicObject::InternalSerialize(bag, attributeTypes);
@ -592,7 +592,7 @@ void CompatLog::InternalSerialize(const Dictionary::Ptr& bag, int attributeTypes
} }
} }
void CompatLog::InternalDeserialize(const Dictionary::Ptr& bag, int attributeTypes) void CompatLogger::InternalDeserialize(const Dictionary::Ptr& bag, int attributeTypes)
{ {
DynamicObject::InternalDeserialize(bag, attributeTypes); DynamicObject::InternalDeserialize(bag, attributeTypes);

View File

@ -17,8 +17,8 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/ ******************************************************************************/
#ifndef COMPATLOG_H #ifndef COMPATLOGGER_H
#define COMPATLOG_H #define COMPATLOGGER_H
#include "icinga/service.h" #include "icinga/service.h"
#include "base/dynamicobject.h" #include "base/dynamicobject.h"
@ -33,13 +33,13 @@ namespace icinga
* *
* @ingroup compat * @ingroup compat
*/ */
class CompatLog : public DynamicObject class CompatLogger : public DynamicObject
{ {
public: public:
DECLARE_PTR_TYPEDEFS(CompatLog); DECLARE_PTR_TYPEDEFS(CompatLogger);
DECLARE_TYPENAME(CompatLog); DECLARE_TYPENAME(CompatLogger);
CompatLog(void); CompatLogger(void);
String GetLogDir(void) const; String GetLogDir(void) const;
String GetRotationMethod(void) const; String GetRotationMethod(void) const;
@ -78,4 +78,4 @@ private:
} }
#endif /* COMPATLOG_H */ #endif /* COMPATLOGGER_H */