-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogger.h
61 lines (44 loc) · 1.33 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
49
50
51
52
53
54
55
56
57
58
59
60
61
////////////////////////////////////////////////////////////////////////////////////////
//
// humifand - the humidity fan deamon
//
// Please check www.way2.net for more information
//
// (c) Copyright 2014 by way2.net Services.
//
////////////////////////////////////////////////////////////////////////////////////////
#ifndef CUSTOM_CLogger_H
#define CUSTOM_CLogger_H
#include <fstream>
#include <iostream>
#include <cstdarg>
#include <string>
using namespace std;
////////////////////////////////////////////////////////////////////////////////////////
#define LOGGER CLogger::getLogger()
////////////////////////////////////////////////////////////////////////////////////////
class CLogger
{
public:
bool OpenLog(const std::string &f_filename)
{
return OpenLog(f_filename.c_str());
}
bool OpenLog(const char *f_filename);
void Log(const std::string& sMessage);
void Log(const char *format, ... );
CLogger& operator<<(const string& sMessage );
static CLogger* getLogger();
private:
CLogger();
CLogger( const CLogger&){};
CLogger& operator=(const CLogger& )
{
return *this;
};
string CurrentDateTime(void);
static CLogger* m_pThis;
static ofstream m_Logfile;
};
////////////////////////////////////////////////////////////////////////////////////////
#endif