-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogger.cpp
More file actions
60 lines (48 loc) · 935 Bytes
/
Logger.cpp
File metadata and controls
60 lines (48 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include "Logger.h"
using namespace std;
Logger::Logger()
{
openlog(Logger::getLoggerName(), LOG_PID, 0);
}
Logger::~Logger()
{
closelog();
destroy();
}
void Logger::debug(const string& message) const
{
syslog(LOG_DEBUG, message.c_str());
}
void Logger::destroy()
{
delete instance_;
}
void Logger::error(const string& message) const
{
syslog(LOG_ERR, message.c_str());
}
Logger* Logger::getInstance()
{
if(instance_ == 0) {
return instance_ = new Logger();
} else {
return instance_;
}
}
void Logger::info(const string& message) const
{
syslog(LOG_INFO, message.c_str());
}
void Logger::notice(const string& message) const
{
syslog(LOG_NOTICE, message.c_str());
}
void Logger::warning(const string& message) const
{
syslog(LOG_WARNING, message.c_str());
}
const char* Logger::getLoggerName()
{
return "mplex";
}
Logger* Logger::instance_ = 0;