-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogger.hpp
43 lines (37 loc) · 1015 Bytes
/
logger.hpp
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
#ifndef LOGGER_HPP
#define LOGGER_HPP
#include <string>
#if defined(Q_OS_WIN)
#define LOG_EMERG 0 /* system is unusable */
#define LOG_ALERT 1 /* action must be taken immediately */
#define LOG_CRIT 2 /* critical conditions */
#define LOG_ERR 3 /* error conditions */
#define LOG_WARNING 4 /* warning conditions */
#define LOG_NOTICE 5 /* normal but significant condition */
#define LOG_INFO 6 /* informational */
#define LOG_DEBUG 7 /* debug-level messages */
#else
#include <sys/syslog.h>
#endif
using namespace std;
class Logger
{
public:
Logger();
~Logger();
void SetLogFilePath(const char *newPath);
void SetLogFilePath(string newPath);
void Log(const char *message, unsigned char msg_level);
void Log(string message, unsigned char msg_level);
static unsigned char LogLevel;
static bool LogFileEnabled;
private:
string pLogFilePath;
char pLogDTstr[256];
time_t pRawTime;
tm *pTimeInfo;
FILE *pLogFile;
static bool pIsBusy;
};
extern Logger *gAppLogger;
#endif // LOGGER_HPP