-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathLogger.h
48 lines (38 loc) · 1.03 KB
/
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
45
46
47
48
#ifndef _LOGGER_H_
#define _LOGGER_H_
#include <string>
#include <stdint.h>
#include "config.h"
using namespace std;
class Logger{
public:
enum LogLevel{
LEVEL_LOG_DEBUG,
LEVEL_LOG_INFO,
LEVEL_LOG_WARN,
LEVEL_LOG_ERROR,
LEVEL_LOG_FATAL
};
static Logger& instance()
{
// The only instance
// Guaranteed to be lazy initialized
// Guaranteed that it will be destroyed correctly
static Logger _instance;
return _instance;
}
~Logger(void);
void init(const std::string &loggerName, Logger::LogLevel logPriority);
void logDebug(const std::string &message) const;
void logInfo(const std::string &message) const;
void logWarning(const std::string &message) const;
void logError(const std::string &message) const;
void logFatal(const std::string &message) const;
private:
// Private Constructor
Logger(){}
// Stop the compiler generating methods of copy the object
Logger(Logger const& copy); // Not Implemented
Logger& operator=(Logger const& copy); // Not Implemented
};
#endif