1 // Copyright 2015-2018 the openage authors. See copying.md for legal info.
2 
3 #pragma once
4 
5 // pxd: from libopenage.util.enum cimport Enum, EnumValue
6 #include "../util/enum.h"
7 
8 
9 namespace openage {
10 namespace log {
11 
12 /**
13  * Data associated with a log level.
14  *
15  * pxd:
16  *
17  * cppclass level_value(EnumValue[level_value, int]):
18  *     const char *colorcode
19  */
20 struct OAAPI level_value : util::EnumValue<level_value> {
21 	const char *colorcode;
22 };
23 
24 
25 /**
26  * Available logging levels.
27  *
28  * pxd:
29  *
30  * cppclass level(Enum[level_value]):
31  *     pass
32  *
33  * level MIN  "::openage::log::level::MIN"
34  * level spam "::openage::log::level::spam"
35  * level dbg  "::openage::log::level::dbg"
36  * level info "::openage::log::level::info"
37  * level warn "::openage::log::level::warn"
38  * level err  "::openage::log::level::err"
39  * level crit "::openage::log::level::crit"
40  * level MAX  "::openage::log::level::MAX"
41  */
42 
43 struct OAAPI level : util::Enum<level_value> {
44 	using util::Enum<level_value>::Enum;
45 
46 	// a default constructor for level.
47 	// this is needed to allow use from Cython.
48 	// initializes the level to an internal UNDEFINED value.
49 	level();
50 
51 	static constexpr level_value MIN       {{"min loglevel", -1000}, "5"};
52 
53 	static constexpr level_value spam      {{"SPAM",          -100}, ""};
54 	static constexpr level_value dbg       {{"DBG",            -20}, ""};
55 	static constexpr level_value info      {{"INFO",             0}, ""};
56 	static constexpr level_value warn      {{"WARN",           100}, "33"};
57 	static constexpr level_value err       {{"ERR",            200}, "31;1"};
58 	static constexpr level_value crit      {{"CRIT",           500}, "31;1;47"};
59 
60 	static constexpr level_value MAX       {{"max loglevel",  1000}, "5"};
61 };
62 
63 }} // namespace openage::log
64