Add Logger Class

This commit is contained in:
2020-03-05 12:59:29 +01:00
parent 96d4dc0be9
commit b4f9aa4cb2
6 changed files with 73 additions and 24 deletions
+4 -7
View File
@@ -1,7 +1,7 @@
#include <algorithm>
#include <sstream>
#include <syslog.h>
#include "Util/JSON.h"
#include "Util/Logger.h"
#include "Functions.h"
#include "Device.h"
@@ -57,7 +57,7 @@ void Device::UpdateDevicesFromInventory()
{
std::stringstream ss;
ss << "Bluetooth::Device::GetDevicesFromInventory() - Error: " << e.what() << std::endl;
syslog(LOG_ERR, "%s", ss.str().c_str());
Util::Logger::Log(Util::Logger::Severity::Error, ss.str());
}
}
@@ -82,7 +82,7 @@ void Device::UpdatePresentDevices()
{
std::stringstream ss;
ss << "Bluetooth::Device::UpdatePresentDevices() - Error: " << e.what() << std::endl;
syslog(LOG_ERR, "%s", ss.str().c_str());
Util::Logger::Log(Util::Logger::Severity::Error, ss.str());
}
}
@@ -103,7 +103,7 @@ void Device::SendStateChange(bool present, const std::string& macAddress)
std::stringstream ss;
ss << "Bluetooth: " << 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 << "/Bluetooth/" << sign << "/" << macAddress;
@@ -114,9 +114,6 @@ void Device::SendStateChange(bool present, const std::string& macAddress)
}
catch (const std::exception& e)
{
std::stringstream ss;
ss << "Bluetooth::Device::SendStateChange() - Error: " << e.what() << std::endl;
syslog(LOG_ERR, "%s", ss.str().c_str());
}
}
-1
View File
@@ -1,7 +1,6 @@
#include <sstream>
#include <vector>
#include <stdexcept>
#include <syslog.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/l2cap.h>