Add Logger Class
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include "Util/clipp.h"
|
||||
#include "Util/INIh.h"
|
||||
#include "Util/Logger.h"
|
||||
#include "UniFi/Device.h"
|
||||
#include "Bluetooth/Device.h"
|
||||
|
||||
@@ -15,8 +16,8 @@ int main(int argc, char** argv)
|
||||
{
|
||||
try
|
||||
{
|
||||
setlogmask(LOG_UPTO(LOG_INFO));
|
||||
openlog("PresenceDetection", LOG_CONS | LOG_NDELAY | LOG_PERROR | LOG_PID, LOG_USER);
|
||||
setlogmask(LOG_UPTO(LOG_DEBUG));
|
||||
openlog("PresenceDetection", LOG_NDELAY | LOG_PID, LOG_USER);
|
||||
|
||||
bool daemon = false;
|
||||
PresenceDetection::Util::group cli {
|
||||
@@ -38,7 +39,7 @@ int main(int argc, char** argv)
|
||||
|
||||
if (daemon)
|
||||
{
|
||||
syslog(LOG_INFO, "Starting Daemon");
|
||||
PresenceDetection::Util::Logger::Log(PresenceDetection::Util::Logger::Severity::Info, "Starting Daemon");
|
||||
pid_t pid, sid;
|
||||
pid = fork();
|
||||
|
||||
@@ -112,7 +113,7 @@ int main(int argc, char** argv)
|
||||
int sig;
|
||||
sigwait(&wset,&sig);
|
||||
|
||||
syslog(LOG_INFO, "Stopping...");
|
||||
PresenceDetection::Util::Logger::Log(PresenceDetection::Util::Logger::Severity::Info, "Stopping...");
|
||||
|
||||
if (pUniFiDevice)
|
||||
pUniFiDevice->Stop();
|
||||
@@ -134,7 +135,7 @@ int main(int argc, char** argv)
|
||||
ss << "ERROR: " << e.what() << std::endl;
|
||||
|
||||
std::cerr << ss.str() << std::endl;
|
||||
syslog(LOG_ERR, "%s", ss.str().c_str());
|
||||
PresenceDetection::Util::Logger::Log(PresenceDetection::Util::Logger::Severity::Error, ss.str());
|
||||
|
||||
closelog();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user