2
3
4
5
13
14
30 if (m_GlobalConsolePool.find(name) == m_GlobalConsolePool.end())
32 m_GlobalConsolePool[name] = std::make_shared<Console>(filePath);
35 return m_GlobalConsolePool[name];
62
63
64 time_t t = std::chrono::system_clock::to_time_t(msg.time);
65 std::string times = ctime(&t);
69
70
75 case spdlog::level::level_enum::trace:
76 helper.level =
"trace";
77 helper.color = glm::vec4(0.83f, 0.83f, 0.83f, 1.0f);
78 ss <<
"[" << times <<
"] [" << msg.logger_name.data() <<
"] [" << helper.level <<
"] " << msg.payload.data();
79 helper.str = ss.str();
80 if (m_InfoData.m_TraceLogInfos.size() == m_MaxInfos)
82 m_InfoData.m_TraceLogInfos.pop_front();
84 m_InfoData.m_TraceLogInfos.push_back(helper);
87 case spdlog::level::level_enum::info:
88 helper.level =
"info";
89 helper.color = glm::vec4(0.574f, 0.829f, 1.0f, 1.0f);
90 ss <<
"[" << times <<
"] [" << msg.logger_name.data() <<
"] [" << helper.level <<
"] " << msg.payload.data();
91 helper.str = ss.str();
92 if (m_InfoData.m_InfoLogInfos.size() == m_MaxInfos)
94 m_InfoData.m_InfoLogInfos.pop_front();
96 m_InfoData.m_InfoLogInfos.push_back(helper);
99 case spdlog::level::level_enum::warn:
100 helper.level =
"warn";
101 helper.color = glm::vec4(0.974f, 0.896f, 0.39f, 1.0f);
102 ss <<
"[" << times <<
"] [" << msg.logger_name.data() <<
"] [" << helper.level <<
"] " << msg.payload.data();
103 helper.str = ss.str();
104 if (m_InfoData.m_WarnLogInfos.size() == m_MaxInfos)
106 m_InfoData.m_WarnLogInfos.pop_front();
108 m_InfoData.m_WarnLogInfos.push_back(helper);
111 case spdlog::level::level_enum::err:
112 helper.level =
"error";
113 helper.color = glm::vec4(1.0f, 0.641f, 0.59f, 1.0f);
114 ss <<
"[" << times <<
"] [" << msg.logger_name.data() <<
"] [" << helper.level <<
"] " << msg.payload.data();
115 helper.str = ss.str();
116 if (m_InfoData.m_ErrorLogInfos.size() == m_MaxInfos)
118 m_InfoData.m_ErrorLogInfos.pop_front();
120 m_InfoData.m_ErrorLogInfos.push_back(helper);
123 case spdlog::level::level_enum::critical:
124 helper.level =
"critical";
125 helper.color = glm::vec4(1.0f, 0.0f, 0.0f, 1.0f);
126 ss <<
"[" << times <<
"] [" << msg.logger_name.data() <<
"] [" << helper.level <<
"] " << msg.payload.data();
127 helper.str = ss.str();
128 if (m_InfoData.m_CriticalLogInfos.size() == m_MaxInfos)
130 m_InfoData.m_CriticalLogInfos.pop_front();
132 m_InfoData.m_CriticalLogInfos.push_back(helper);
#define SPICES_PROFILE_ZONE
static std::shared_ptr< Console > Registry(const std::string &name, const std::string &filePath="")
Registry a console to ConsolePool.
Console(const std::string &filePath, uint32_t maxInfos=50)
Constructor Function.
std::string m_FilePath
Console File Path.
void Push(const std::string &cmd)
Push a Command to Console.
void Clear()
Clear Console Infos.
void sink_it_(const spdlog::details::log_msg &msg) override
Inherited from spdlog, run when a message pushed.
uint32_t m_MaxInfos
Maximum Num of Information's.
static std::unordered_map< std::string, std::shared_ptr< Console > > m_GlobalConsolePool
Global Console Pool.
Help data of specific level of information.