diff --git a/core/base/Console.cpp b/core/base/Console.cpp index a68f6b328ec1..342de077e6ae 100644 --- a/core/base/Console.cpp +++ b/core/base/Console.cpp @@ -118,6 +118,9 @@ AX_API LogItem& preprocessLog(LogItem&& item) std::string_view levelName; switch (item.level_) { + case LogLevel::Trace: + levelName = "T/"sv; + break; case LogLevel::Debug: levelName = "D/"sv; break; @@ -140,6 +143,10 @@ AX_API LogItem& preprocessLog(LogItem&& item) constexpr auto colorCodeOfLevel = [](LogLevel level) -> std::string_view { switch (level) { + case LogLevel::Trace: + return "\x1b[37m"sv; + case LogLevel::Debug: + return "\x1b[36m"sv; case LogLevel::Info: return "\x1b[92m"sv; case LogLevel::Warn: diff --git a/core/base/Console.h b/core/base/Console.h index 3c1599a5f423..893f2b4caf12 100644 --- a/core/base/Console.h +++ b/core/base/Console.h @@ -59,6 +59,7 @@ NS_AX_BEGIN enum class LogLevel { + Trace, Debug, Info, Warn, @@ -163,6 +164,7 @@ inline void printLogT(_FmtType&& fmt, LogItem& item, _Types&&... args) #define AXLOG_WITH_LEVEL(level, fmtOrMsg, ...) \ ax::printLogT(FMT_COMPILE("{}" fmtOrMsg), ax::preprocessLog(ax::LogItem{level}), ##__VA_ARGS__) +#define AXLOGT(fmtOrMsg, ...) AXLOG_WITH_LEVEL(ax::LogLevel::Trace, fmtOrMsg, ##__VA_ARGS__) #define AXLOGD(fmtOrMsg, ...) AXLOG_WITH_LEVEL(ax::LogLevel::Debug, fmtOrMsg, ##__VA_ARGS__) #define AXLOGI(fmtOrMsg, ...) AXLOG_WITH_LEVEL(ax::LogLevel::Info, fmtOrMsg, ##__VA_ARGS__) #define AXLOGW(fmtOrMsg, ...) AXLOG_WITH_LEVEL(ax::LogLevel::Warn, fmtOrMsg, ##__VA_ARGS__)