blob: 59d8b12a3347eeb11d970b32851ff4d1f96b9c7b (
plain) (
blame)
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
|
#if defined(_WIN32)
#include "windows_stream.h"
#include <windows.h>
windows_stream::windows_stream(unsigned int pLevel)
:
mLevel(pLevel)
{
}
std::ostream& operator << (std::ostream &stream, windows_stream const& object)
{
HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
if (object.mLevel >= 100)
{
SetConsoleTextAttribute(h_stdout, FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_INTENSITY);
return stream;
}
if (object.mLevel >= 90)
{
SetConsoleTextAttribute(h_stdout, FOREGROUND_RED | FOREGROUND_INTENSITY | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY);
return stream;
}
if (object.mLevel >= 80)
{
SetConsoleTextAttribute(h_stdout, BACKGROUND_BLUE | BACKGROUND_RED | BACKGROUND_INTENSITY);
return stream;
}
if (object.mLevel >= 75)
{
SetConsoleTextAttribute(h_stdout, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_INTENSITY);
return stream;
}
if (object.mLevel >= 70)
{
SetConsoleTextAttribute(h_stdout, FOREGROUND_GREEN | FOREGROUND_INTENSITY);
return stream;
}
if (object.mLevel >= 50)
{
SetConsoleTextAttribute(h_stdout, FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
return stream;
}
if (object.mLevel >= 40)
{
SetConsoleTextAttribute(h_stdout, FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_INTENSITY);
return stream;
}
if (object.mLevel >= 30)
{
SetConsoleTextAttribute(h_stdout, FOREGROUND_BLUE | FOREGROUND_INTENSITY);
return stream;
}
if (object.mLevel >= 20)
{
SetConsoleTextAttribute(h_stdout, FOREGROUND_BLUE);
return stream;
}
return stream;
}
#endif
|