-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogging.h
More file actions
36 lines (30 loc) · 794 Bytes
/
logging.h
File metadata and controls
36 lines (30 loc) · 794 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
#ifndef LOGGING_H_
#define LOGGING_H_
#include <syslog.h>
namespace schrandr {
class Logger {
public:
Logger();
~Logger();
void enable_syslog();
void log(const std::string &msg);
void log(char *msg);
void log(int level, const std::string &msg);
void log(int level, char* msg);
template<class T>
void log(std::vector<T> messages)
{
std::cout << "Debug 2" << std::endl;
if (!messages.empty()) {
for(typename std::vector<T>::iterator it = messages.begin();
it != messages.end();
++it) {
log(*it);
}
}
}
private:
bool syslog_;
};
}
#endif