TrinityCore
AppenderConsole.h
Go to the documentation of this file.
1
/*
2
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3
*
4
* This program is free software; you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License as published by the
6
* Free Software Foundation; either version 2 of the License, or (at your
7
* option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
* more details.
13
*
14
* You should have received a copy of the GNU General Public License along
15
* with this program. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#ifndef APPENDERCONSOLE_H
19
#define APPENDERCONSOLE_H
20
21
#include "
Appender.h
"
22
23
// EnumUtils: DESCRIBE THIS
24
enum
ColorTypes
25
{
26
BLACK
,
27
RED
,
28
GREEN
,
29
BROWN
,
30
BLUE
,
31
MAGENTA
,
32
CYAN
,
33
GREY
,
34
YELLOW
,
35
LRED
,
36
LGREEN
,
37
LBLUE
,
38
LMAGENTA
,
39
LCYAN
,
40
WHITE
,
41
NUM_COLOR_TYPES
// SKIP
42
};
43
44
class
TC_COMMON_API
AppenderConsole
:
public
Appender
45
{
46
public
:
47
static
constexpr
AppenderType
type =
APPENDER_CONSOLE
;
48
49
AppenderConsole
(
uint8
_id, std::string
const
& name,
LogLevel
level,
AppenderFlags
flags
, std::vector<std::string_view>
const
& args);
50
void
InitColors(std::string
const
& name, std::string_view init_str);
51
AppenderType
getType
()
const override
{
return
type; }
52
53
private
:
54
void
SetColor(
bool
stdout_stream,
ColorTypes
color);
55
void
ResetColor(
bool
stdout_stream);
56
void
Print(std::string
const
& str,
bool
error);
57
void
_write
(
LogMessage
const
* message)
override
;
58
bool
_colored
;
59
ColorTypes
_colors[
NUM_ENABLED_LOG_LEVELS
];
60
};
61
62
#endif
ColorTypes
ColorTypes
Definition:
AppenderConsole.h:25
BROWN
@ BROWN
Definition:
AppenderConsole.h:29
LRED
@ LRED
Definition:
AppenderConsole.h:35
WHITE
@ WHITE
Definition:
AppenderConsole.h:40
BLUE
@ BLUE
Definition:
AppenderConsole.h:30
GREY
@ GREY
Definition:
AppenderConsole.h:33
LMAGENTA
@ LMAGENTA
Definition:
AppenderConsole.h:38
MAGENTA
@ MAGENTA
Definition:
AppenderConsole.h:31
NUM_COLOR_TYPES
@ NUM_COLOR_TYPES
Definition:
AppenderConsole.h:41
GREEN
@ GREEN
Definition:
AppenderConsole.h:28
CYAN
@ CYAN
Definition:
AppenderConsole.h:32
LBLUE
@ LBLUE
Definition:
AppenderConsole.h:37
LCYAN
@ LCYAN
Definition:
AppenderConsole.h:39
YELLOW
@ YELLOW
Definition:
AppenderConsole.h:34
LGREEN
@ LGREEN
Definition:
AppenderConsole.h:36
BLACK
@ BLACK
Definition:
AppenderConsole.h:26
RED
@ RED
Definition:
AppenderConsole.h:27
Appender.h
uint8
uint8_t uint8
Definition:
Define.h:144
TC_COMMON_API
#define TC_COMMON_API
Definition:
Define.h:99
flags
uint16 flags
Definition:
DisableMgr.cpp:49
AppenderFlags
AppenderFlags
Definition:
LogCommon.h:50
AppenderType
AppenderType
Definition:
LogCommon.h:40
APPENDER_CONSOLE
@ APPENDER_CONSOLE
Definition:
LogCommon.h:42
LogLevel
LogLevel
Definition:
LogCommon.h:25
NUM_ENABLED_LOG_LEVELS
@ NUM_ENABLED_LOG_LEVELS
Definition:
LogCommon.h:34
AppenderConsole
Definition:
AppenderConsole.h:45
AppenderConsole::_colored
bool _colored
Definition:
AppenderConsole.h:58
AppenderConsole::getType
AppenderType getType() const override
Definition:
AppenderConsole.h:51
Appender
Definition:
Appender.h:30
Appender::_write
virtual void _write(LogMessage const *)=0
LogMessage
Definition:
LogMessage.h:27
common
Logging
AppenderConsole.h
Generated on Thu Mar 14 2024 23:39:07 for TrinityCore by
1.9.4