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
|
#ifndef APPENDERCONSOLE_H
#define APPENDERCONSOLE_H
#include "Appender.h"
#include <string>
enum ColorTypes
{
BLACK,
RED,
GREEN,
BROWN,
BLUE,
MAGENTA,
CYAN,
GREY,
YELLOW,
LRED,
LGREEN,
LBLUE,
LMAGENTA,
LCYAN,
WHITE
};
const uint8 MaxColors = uint8(WHITE) + 1;
class AppenderConsole: public Appender
{
public:
AppenderConsole(uint8 _id, std::string const& name, LogLevel level);
void InitColors(const std::string& init_str);
private:
void SetColor(bool stdout_stream, ColorTypes color);
void ResetColor(bool stdout_stream);
void _write(LogMessage& message);
bool _colored;
ColorTypes _colors[MaxLogLevels];
};
#endif
|