aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2026-02-16 15:37:13 +0100
committerGitHub Enterprise <[email protected]>2026-02-16 15:37:13 +0100
commit74a5e2fb8dec43682e81a98c9677aef849ca7cc1 (patch)
tree295fddb6b008be9f9012acca069d9c18727439a5 /src
parentadd foundation for http password protection (#756) (diff)
downloadzen-74a5e2fb8dec43682e81a98c9677aef849ca7cc1.tar.xz
zen-74a5e2fb8dec43682e81a98c9677aef849ca7cc1.zip
added ResetConsoleLog (#758)
also made sure log initialization calls it to ensure the console output format is retained even if the console logger was set up before logging is initialized
Diffstat (limited to 'src')
-rw-r--r--src/zencore/include/zencore/logging.h1
-rw-r--r--src/zencore/logging.cpp8
-rw-r--r--src/zenutil/logging.cpp5
3 files changed, 14 insertions, 0 deletions
diff --git a/src/zencore/include/zencore/logging.h b/src/zencore/include/zencore/logging.h
index afbbbd3ee..74a44d028 100644
--- a/src/zencore/include/zencore/logging.h
+++ b/src/zencore/include/zencore/logging.h
@@ -31,6 +31,7 @@ void FlushLogging();
LoggerRef Default();
void SetDefault(std::string_view NewDefaultLoggerId);
LoggerRef ConsoleLog();
+void ResetConsoleLog();
void SuppressConsoleLog();
LoggerRef ErrorLog();
void SetErrorLog(std::string_view LoggerId);
diff --git a/src/zencore/logging.cpp b/src/zencore/logging.cpp
index a6697c443..77e05a909 100644
--- a/src/zencore/logging.cpp
+++ b/src/zencore/logging.cpp
@@ -405,6 +405,14 @@ ConsoleLog()
}
void
+ResetConsoleLog()
+{
+ LoggerRef ConLog = ConsoleLog();
+
+ ConLog.SpdLogger->set_pattern("%v");
+}
+
+void
InitializeLogging()
{
ZEN_MEMSCOPE(ELLMTag::Logging);
diff --git a/src/zenutil/logging.cpp b/src/zenutil/logging.cpp
index 806b96d52..54ac30c5d 100644
--- a/src/zenutil/logging.cpp
+++ b/src/zenutil/logging.cpp
@@ -233,6 +233,11 @@ FinishInitializeLogging(const LoggingOptions& LogOptions)
LogOptions.LogId,
std::chrono::system_clock::now() - std::chrono::milliseconds(GetTimeSinceProcessStart()))); // default to duration prefix
+ // If the console logger was initialized before, the above will change the output format
+ // so we need to reset it
+
+ logging::ResetConsoleLog();
+
if (g_FileSink)
{
if (LogOptions.AbsLogFile.extension() == ".json")