forked from hyphanet/lib-CppFCPLib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLog.h
46 lines (32 loc) · 706 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
41
42
43
44
45
46
#ifndef LOG_H_
#define LOG_H_
#include "zthread/Thread.h"
#include "zthread/Mutex.h"
#include <iostream>
#include <string>
namespace FCPLib {
typedef enum {
SILENT,
FATAL,
CRITICAL,
ERROR,
INFO,
DETAIL,
DEBUG,
NOISY,
} verbosityLevel;
class Logger;
Logger&
log(std::ostream &out_=std::cerr, verbosityLevel logLevel_=DEBUG);
class Logger{
friend Logger& log(std::ostream&, verbosityLevel);
ZThread::Mutex lock;
std::ostream &out;
verbosityLevel logLevel;
Logger(std::ostream &out_, verbosityLevel logLevel_=ERROR);
public:
void log(verbosityLevel logLevel, const char *message);
void log(verbosityLevel logLevel, std::string message);
};
}
#endif