diff options
| -rw-r--r-- | src/zencore/logging/ansicolorsink.cpp | 10 | ||||
| -rw-r--r-- | src/zenutil/logging/fullformatter.cpp | 11 |
2 files changed, 20 insertions, 1 deletions
diff --git a/src/zencore/logging/ansicolorsink.cpp b/src/zencore/logging/ansicolorsink.cpp index c11b3760d..1a8201876 100644 --- a/src/zencore/logging/ansicolorsink.cpp +++ b/src/zencore/logging/ansicolorsink.cpp @@ -68,12 +68,22 @@ public: Dest.push_back(']'); Dest.push_back(' '); + using namespace std::literals; + // logger name if (Msg.GetLoggerName().size() > 0) { + if (IsColorEnabled()) + { + Dest.append("\033[97m"sv); + } Dest.push_back('['); helpers::AppendStringView(Msg.GetLoggerName(), Dest); Dest.push_back(']'); + if (IsColorEnabled()) + { + Dest.append("\033[0m"sv); + } Dest.push_back(' '); } diff --git a/src/zenutil/logging/fullformatter.cpp b/src/zenutil/logging/fullformatter.cpp index 33e6d3161..283a8bc37 100644 --- a/src/zenutil/logging/fullformatter.cpp +++ b/src/zenutil/logging/fullformatter.cpp @@ -12,6 +12,7 @@ #include <atomic> #include <chrono> #include <string> +#include "zencore/logging.h" namespace zen::logging { @@ -25,7 +26,7 @@ struct FullFormatter::Impl { } - explicit Impl(std::string_view LogId) : m_LogId(LogId), m_LinePrefix(128, ' '), m_UseFullDate(true) {} + explicit Impl(std::string_view LogId) : m_LogId(LogId), m_LinePrefix(128, ' ') {} std::chrono::time_point<std::chrono::system_clock> m_Epoch; std::tm m_CachedLocalTm{}; @@ -172,9 +173,17 @@ FullFormatter::Format(const LogMessage& Msg, MemoryBuffer& OutBuffer) // logger name if (Msg.GetLoggerName().size() > 0) { + if (IsColorEnabled()) + { + OutBuffer.append("\033[1m"sv); + } OutBuffer.push_back('['); helpers::AppendStringView(Msg.GetLoggerName(), OutBuffer); OutBuffer.push_back(']'); + if (IsColorEnabled()) + { + OutBuffer.append("\033[0m"sv); + } OutBuffer.push_back(' '); } |