forked from gsingh93/slim-display-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
log.h
40 lines (32 loc) · 685 Bytes
/
log.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
#ifndef _LOG_H_
#define _LOG_H_
#ifdef USE_CONSOLEKIT
#include "Ck.h"
#endif
#ifdef USE_PAM
#include "PAM.h"
#endif
#include "const.h"
#include <fstream>
using namespace std;
static class LogUnit {
ofstream logFile;
public:
bool openLog(const char * filename);
void closeLog();
~LogUnit() { closeLog(); }
template<typename Type>
LogUnit & operator<<(const Type & text) {
logFile << text; logFile.flush();
return *this;
}
LogUnit & operator<<(ostream & (*fp)(ostream&)) {
logFile << fp; logFile.flush();
return *this;
}
LogUnit & operator<<(ios_base & (*fp)(ios_base&)) {
logFile << fp; logFile.flush();
return *this;
}
} logStream;
#endif /* _LOG_H_ */