forked from jackburton79/ocs-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Logger.h
44 lines (34 loc) · 934 Bytes
/
Logger.h
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
/*
* Logger.h
*
* Created on: 05/lug/2017
* Author: Stefano Ceccherini
*/
#ifndef LOGGER_H_
#define LOGGER_H_
#include <string>
#include <syslog.h>
class Logger {
public:
enum LOGGER_TYPE {
LOGGER_TYPE_DEFAULT = 0,
LOGGER_TYPE_STDERR = 1,
LOGGER_TYPE_SYSLOG = 2
};
Logger(const char* logName);
virtual ~Logger();
void SetLevel(int level);
void Log(int level, const char* const string);
void LogFormat(int level, const char* fmtString, ...);
// There can be only one logger per application.
// The first call will create the requested logger.
// Subsequent calls will return the previously created logger,
// even if called with different parameters.
static Logger& GetDefault();
static Logger& Get(int loggerType = LOGGER_TYPE_DEFAULT);
static Logger& Get(const std::string& loggerType);
private:
virtual void DoLog(int level, const char* string) = 0;
int fLevel;
};
#endif /* LOGGER_H_ */