MSTL
1.4.0
A Modern C++ Library with extended functionality, web components, and utility libraries
载入中...
搜索中...
未找到
log_event.hpp
1
#ifndef MSTL_LOGGING_LOG_EVENT_HPP__
2
#define MSTL_LOGGING_LOG_EVENT_HPP__
3
#include "MSTL/core/container/unordered_map.hpp"
4
#include "MSTL/core/time/datetime.hpp"
5
#include "
MSTL/core/async/thread.hpp
"
6
MSTL_BEGIN_NAMESPACE__
7
8
#ifdef ERROR
9
#undef ERROR
10
#endif
11
12
enum class
LOG_LEVEL {
13
TRACE=0, DEBUG, INFO, WARN, ERROR, FATAL
14
};
15
16
MSTL_CONSTEXPR20
string
to_string(
const
LOG_LEVEL level) {
17
switch
(level) {
18
case
LOG_LEVEL::TRACE:
return
"TRACE"
;
19
case
LOG_LEVEL::DEBUG:
return
"DEBUG"
;
20
case
LOG_LEVEL::INFO:
return
"INFO"
;
21
case
LOG_LEVEL::WARN:
return
"WARN"
;
22
case
LOG_LEVEL::ERROR:
return
"ERROR"
;
23
case
LOG_LEVEL::FATAL:
return
"FATAL"
;
24
default
:
return
"UNKNOWN"
;
25
}
26
}
27
28
29
struct
log_event {
30
unordered_map<string, string> context;
31
string
file;
32
string
func;
33
string
message;
34
datetime dt;
35
int
line;
36
thread::id thread_id;
37
LOG_LEVEL level;
38
};
39
40
MSTL_END_NAMESPACE__
41
#endif
// MSTL_LOGGING_LOG_EVENT_HPP__
MSTL_END_NAMESPACE__
#define MSTL_END_NAMESPACE__
结束全局命名空间MSTL
定义
c++config.hpp:268
MSTL_BEGIN_NAMESPACE__
#define MSTL_BEGIN_NAMESPACE__
开始全局命名空间MSTL
定义
c++config.hpp:262
thread.hpp
MSTL线程支持
include
MSTL
logging
log_event.hpp
制作者
1.16.0