* 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/checkcommand.h"
#include "icinga/notification.h"
using namespace icinga;
-REGISTER_TYPE(CompatLog);
-REGISTER_SCRIPTFUNCTION(ValidateRotationMethod, &CompatLog::ValidateRotationMethod);
+REGISTER_TYPE(CompatLogger);
+REGISTER_SCRIPTFUNCTION(ValidateRotationMethod, &CompatLogger::ValidateRotationMethod);
-CompatLog::CompatLog(void)
+CompatLogger::CompatLogger(void)
: m_LastRotation(0)
{ }
/**
* @threadsafety Always.
*/
-void CompatLog::Start(void)
+void CompatLogger::Start(void)
{
DynamicObject::Start();
- Service::OnNewCheckResult.connect(bind(&CompatLog::CheckResultHandler, this, _1, _2));
- Service::OnNotificationSentToUser.connect(bind(&CompatLog::NotificationSentHandler, this, _1, _2, _3, _4, _5, _6));
- Service::OnFlappingChanged.connect(bind(&CompatLog::FlappingHandler, this, _1, _2));
- Service::OnDowntimeTriggered.connect(boost::bind(&CompatLog::TriggerDowntimeHandler, this, _1, _2));
- Service::OnDowntimeRemoved.connect(boost::bind(&CompatLog::RemoveDowntimeHandler, this, _1, _2));
+ Service::OnNewCheckResult.connect(bind(&CompatLogger::CheckResultHandler, this, _1, _2));
+ Service::OnNotificationSentToUser.connect(bind(&CompatLogger::NotificationSentHandler, this, _1, _2, _3, _4, _5, _6));
+ Service::OnFlappingChanged.connect(bind(&CompatLogger::FlappingHandler, this, _1, _2));
+ Service::OnDowntimeTriggered.connect(boost::bind(&CompatLogger::TriggerDowntimeHandler, this, _1, _2));
+ Service::OnDowntimeRemoved.connect(boost::bind(&CompatLogger::RemoveDowntimeHandler, this, _1, _2));
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();
ReopenFile(false);
/**
* @threadsafety Always.
*/
-String CompatLog::GetLogDir(void) const
+String CompatLogger::GetLogDir(void) const
{
if (!m_LogDir.IsEmpty())
return m_LogDir;
/**
* @threadsafety Always.
*/
-String CompatLog::GetRotationMethod(void) const
+String CompatLogger::GetRotationMethod(void) const
{
if (!m_RotationMethod.IsEmpty())
return m_RotationMethod;
/**
* @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();
/**
* @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();
/**
* @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();
/**
* @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,
const String& author, const String& comment_text)
{
/**
* @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();
}
-void CompatLog::WriteLine(const String& line)
+void CompatLogger::WriteLine(const String& line)
{
ASSERT(OwnsLock());
m_OutputFile << "[" << (long)Utility::GetTime() << "] " << line << "\n";
}
-void CompatLog::Flush(void)
+void CompatLogger::Flush(void)
{
ASSERT(OwnsLock());
/**
* @threadsafety Always.
*/
-void CompatLog::ReopenFile(bool rotate)
+void CompatLogger::ReopenFile(bool rotate)
{
ObjectLock olock(this);
Flush();
}
-void CompatLog::ScheduleNextRotation(void)
+void CompatLogger::ScheduleNextRotation(void)
{
time_t now = (time_t)Utility::GetTime();
String method = GetRotationMethod();
/**
* @threadsafety Always.
*/
-void CompatLog::RotationTimerHandler(void)
+void CompatLogger::RotationTimerHandler(void)
{
try {
ReopenFile(true);
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");
}
}
-void CompatLog::InternalSerialize(const Dictionary::Ptr& bag, int attributeTypes) const
+void CompatLogger::InternalSerialize(const Dictionary::Ptr& bag, int attributeTypes) const
{
DynamicObject::InternalSerialize(bag, attributeTypes);
}
}
-void CompatLog::InternalDeserialize(const Dictionary::Ptr& bag, int attributeTypes)
+void CompatLogger::InternalDeserialize(const Dictionary::Ptr& bag, int attributeTypes)
{
DynamicObject::InternalDeserialize(bag, attributeTypes);