21#if (DL_PLATFORM == DL_PLATFORM_WIN32)
23#include <source_location>
26#include <fmt/format.h>
31 "damage",
"err",
"warn",
"notice",
"msg",
"info",
"test",
"pause",
62 return _stackSetting.top();
72 return level > _levelLimit;
78 return level <= _levelMsgBox;
84 _stackSetting.push(setting);
92 _stackSetting.push(setting);
106 size_t index = (size_t)level;
112 std::stack<Setting> _stackSetting;
116extern LogSystem*
g_log;
137#if (DL_PLATFORM == DL_PLATFORM_WIN32)
141void log_pause0(std::string_view str,
const std::source_location location = std::source_location::current());
142void log_test0(std::string_view str,
const std::source_location location = std::source_location::current());
143void log_info0(std::string_view str,
const std::source_location location = std::source_location::current());
144void log_msg0(std::string_view str,
const std::source_location location = std::source_location::current());
145void log_notice0(std::string_view str,
const std::source_location location = std::source_location::current());
146void log_warn0(std::string_view str,
const std::source_location location = std::source_location::current());
147void log_err0(std::string_view str,
const std::source_location location = std::source_location::current());
148void log_damage0(std::string_view str,
const std::source_location location = std::source_location::current());
151void log(std::string_view str,
const std::source_location location = std::source_location::current());
153void log_err0(
const std::exception& e,
const std::source_location location = std::source_location::current());
155#define log_(str, ...) log(fmt::format(str, __VA_ARGS__), std::source_location::current())
156#define log_pause(str, ...) log_pause0(fmt::format(str, __VA_ARGS__), std::source_location::current())
157#define log_test(str, ...) log_test0(fmt::format(str, __VA_ARGS__), std::source_location::current())
158#define log_info(str, ...) log_info0(fmt::format(str, __VA_ARGS__), std::source_location::current())
159#define log_msg(str, ...) log_msg0(fmt::format(str, __VA_ARGS__), std::source_location::current())
160#define log_notice(str, ...) log_notice0(fmt::format(str, __VA_ARGS__), std::source_location::current())
161#define log_warn(str, ...) log_warn0(fmt::format(str, __VA_ARGS__), std::source_location::current())
162#define log_err(str, ...) log_err0(fmt::format(str, __VA_ARGS__), std::source_location::current())
163#define log_damage(str, ...) log_damage0(fmt::format(str, __VA_ARGS__), std::source_location::current())
167#if (DL_PLATFORM == DL_PLATFORM_LINUX) || (DL_PLATFORM == DL_PLATFORM_ANDROID)
169void log(std::string_view str);
183#define log_(str, ...) log(fmt::format(str, __VA_ARGS__))
184#define log_pause(str, ...) log_pause0(fmt::format(str, __VA_ARGS__))
185#define log_test(str, ...) log_test0(fmt::format(str, __VA_ARGS__))
186#define log_info(str, ...) log_info0(fmt::format(str, __VA_ARGS__))
187#define log_msg(str, ...) log_msg0(fmt::format(str, __VA_ARGS__))
188#define log_notice(str, ...) log_notice0(fmt::format(str, __VA_ARGS__))
189#define log_warn(str, ...) log_warn0(fmt::format(str, __VA_ARGS__))
190#define log_err(str, ...) log_err0(fmt::format(str, __VA_ARGS__))
191#define log_damage(str, ...) log_damage0(fmt::format(str, __VA_ARGS__))
LogLimit(LogSystem::Level level=LogSystem::Level::DAMAGE)
void SetLevelLimit(Level level)
设置日志输出等级(大于自己不输出)
bool IsLevelLimit(Level level)
检查等级是否被限制输出
Setting & GetSetting()
返回当前设置
void PushLevel(Level level)
入栈设置
static std::string_view Level2String(Level level)
日志等级转字符串
bool IsLevelMsgBox(Level level)
检查等级是否可以弹窗(小于等于自己)
void Push(const Setting &setting)
入栈设置
void log_msg0(std::string_view str, const std::source_location location=std::source_location::current())
void log_pause0(std::string_view str, const std::source_location location=std::source_location::current())
输出日志
void log_notice0(std::string_view str, const std::source_location location=std::source_location::current())
constexpr std::array< std::string_view, 9 > DL_LOG_SYSTEM_LEVLE_NAME
void log_warn0(std::string_view str, const std::source_location location=std::source_location::current())
void log_test0(std::string_view str, const std::source_location location=std::source_location::current())
void log(std::string_view str, const std::source_location location=std::source_location::current())
以当前设置输出
void log_info0(std::string_view str, const std::source_location location=std::source_location::current())
void log_err0(std::string_view str, const std::source_location location=std::source_location::current())
void log_damage0(std::string_view str, const std::source_location location=std::source_location::current())