-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLog.h
68 lines (58 loc) · 1.26 KB
/
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef LOG_H_INCLUDED
#define LOG_H_INCLUDED
#include <iostream>
namespace mare_vm {
#define JLOG(x) if (!x) { } else std::cout
class log {
private:
int level = 2;
// 5:fatal, 4:error, 3:warn, 2:info, 1:debug, 0:trace
public:
log() : level(2) {}
log(int level_) : level(level_) {}
/** 5:fatal, 4:error, 3:warn, 2:info, 1:debug, 0:trace */
void set(int level_) { level = level_; }
/** trace는 주의 (mared에 추가X) */
bool trace() const
{
if (level == 0) {
std::cout << std::endl << "[T] ";
return true;
}
return false;
}
bool debug() const
{
if (level < 2) {
std::cout << std::endl << "[D] ";
return true;
}
return false;
}
bool info() const
{
if (level < 3) {
std::cout << std::endl << "[I] ";
return true;
}
return false;
}
bool warn() const
{
if (level < 4) {
std::cout << std::endl << "[W] ";
return true;
}
return false;
}
bool error() const
{
if (level < 5) {
std::cout << std::endl << "[E] ";
return true;
}
return false;
}
};
}
#endif