|
|
@@ -1,6 +1,6 @@
|
|
|
#include <sstream>
|
|
|
-#include <syslog.h>
|
|
|
#include "Util/JSON.h"
|
|
|
+#include "Util/Logger.h"
|
|
|
#include "Device.h"
|
|
|
|
|
|
|
|
|
@@ -69,7 +69,7 @@ bool Device::Login()
|
|
|
{
|
|
|
std::stringstream ss;
|
|
|
ss << "UniFi::Device::Login() - Error: " << e.what() << std::endl;
|
|
|
- syslog(LOG_ERR, "%s", ss.str().c_str());
|
|
|
+ Util::Logger::Log(Util::Logger::Severity::Error, ss.str());
|
|
|
std::lock_guard<std::mutex> lock(m_mutex);
|
|
|
m_loggedIn = false;
|
|
|
return m_loggedIn;
|
|
|
@@ -96,7 +96,7 @@ void Device::Logout()
|
|
|
{
|
|
|
std::stringstream ss;
|
|
|
ss << "UniFi::Device::Logout() - Error: " << e.what() << std::endl;
|
|
|
- syslog(LOG_ERR, "%s", ss.str().c_str());
|
|
|
+ Util::Logger::Log(Util::Logger::Severity::Error, ss.str());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -120,7 +120,7 @@ void Device::UpdateDevicesFromInventory()
|
|
|
{
|
|
|
std::stringstream ss;
|
|
|
ss << "UniFi::Device::GetDevicesFromInventory() - Error: " << e.what() << std::endl;
|
|
|
- syslog(LOG_ERR, "%s", ss.str().c_str());
|
|
|
+ Util::Logger::Log(Util::Logger::Severity::Error, ss.str());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -178,7 +178,7 @@ void Device::UpdatePresentDevices()
|
|
|
{
|
|
|
std::stringstream ss;
|
|
|
ss << "UniFi::Device::IsDevicePresent() - Error: " << e.what() << std::endl;
|
|
|
- syslog(LOG_ERR, "%s", ss.str().c_str());
|
|
|
+ Util::Logger::Log(Util::Logger::Severity::Error, ss.str());
|
|
|
Logout();
|
|
|
return;
|
|
|
}
|
|
|
@@ -206,10 +206,8 @@ void Device::SendStateChange(bool present, const std::string& macAddress)
|
|
|
|
|
|
std::stringstream ss;
|
|
|
ss << "UniFi: " << sign << " " << macAddress;
|
|
|
- syslog(LOG_INFO, "%s", ss.str().c_str());
|
|
|
+ Util::Logger::Log(Util::Logger::Severity::Info, ss.str());
|
|
|
|
|
|
- std::stringstream url;
|
|
|
- url << m_target << "/UniFi/" << sign << "/" << macAddress;
|
|
|
|
|
|
try
|
|
|
{
|
|
|
@@ -217,9 +215,6 @@ void Device::SendStateChange(bool present, const std::string& macAddress)
|
|
|
}
|
|
|
catch (const std::exception& e)
|
|
|
{
|
|
|
- std::stringstream ss;
|
|
|
- ss << "UniFi::Device::SendStateChange() - Error: " << e.what() << std::endl;
|
|
|
- syslog(LOG_ERR, "%s", ss.str().c_str());
|
|
|
}
|
|
|
}
|
|
|
|