aboutsummaryrefslogtreecommitdiff
path: root/src/zenutil/logging/fullformatter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zenutil/logging/fullformatter.cpp')
-rw-r--r--src/zenutil/logging/fullformatter.cpp30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/zenutil/logging/fullformatter.cpp b/src/zenutil/logging/fullformatter.cpp
index 2a4840241..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{};
@@ -155,15 +156,7 @@ FullFormatter::Format(const LogMessage& Msg, MemoryBuffer& OutBuffer)
OutBuffer.push_back(' ');
}
- // append logger name if exists
- if (Msg.GetLoggerName().size() > 0)
- {
- OutBuffer.push_back('[');
- helpers::AppendStringView(Msg.GetLoggerName(), OutBuffer);
- OutBuffer.push_back(']');
- OutBuffer.push_back(' ');
- }
-
+ // level
OutBuffer.push_back('[');
if (IsColorEnabled())
{
@@ -177,6 +170,23 @@ FullFormatter::Format(const LogMessage& Msg, MemoryBuffer& OutBuffer)
OutBuffer.push_back(']');
OutBuffer.push_back(' ');
+ // 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(' ');
+ }
+
// add source location if present
if (Msg.GetSource())
{