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"
7
8#ifdef ERROR
9#undef ERROR
10#endif
11
12enum class LOG_LEVEL {
13 TRACE=0, DEBUG, INFO, WARN, ERROR, FATAL
14};
15
16MSTL_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
29struct 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
41#endif // MSTL_LOGGING_LOG_EVENT_HPP__
#define MSTL_END_NAMESPACE__
结束全局命名空间MSTL
#define MSTL_BEGIN_NAMESPACE__
开始全局命名空间MSTL
MSTL线程支持