forked from pig4210/xlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xlog.cpp
58 lines (48 loc) · 906 Bytes
/
xlog.cpp
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
#include "xlog.h"
xlog::levels xlog::dynamic_lvl = xlog::lvl_on;
size_t xlog::dynamic_type = (size_t)(0-1);
xlog::~xlog()
{
out();
}
void xlog::out()
{
if(empty()) return;
#ifndef FOR_RING0
OutputDebugStringA(c_str());
#else
DbgPrint("%s\n",c_str());
#endif
clear();
}
xlog::levels xlog::set_level(xlog::levels new_level)
{
levels lvl = dynamic_lvl;
dynamic_lvl = new_level;
return lvl;
}
size_t xlog::open_type(size_t be_set_type)
{
size_t tmp_type = dynamic_type;
dynamic_type |= ((size_t)(1)<<be_set_type);
return tmp_type;
}
size_t xlog::close_type(size_t be_set_type)
{
size_t tmp_type = dynamic_type;
dynamic_type &= ~((size_t)(1)<<be_set_type);
return tmp_type;
}
xlog::levels xlog::level()
{
return dynamic_lvl;
}
size_t xlog::type()
{
return dynamic_type;
}
xmsg& xlogout(xmsg& v)
{
(*(xlog*)&v).out();
return v;
}