From 3a171f742c31addf5a343e8a6905054a1fbb12aa Mon Sep 17 00:00:00 2001 From: klementtan Date: Tue, 31 May 2022 23:28:16 +0800 Subject: logging: fix logging empty threadname --- src/logging.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/logging.cpp') diff --git a/src/logging.cpp b/src/logging.cpp index f1a86f0dce..1e2c1d5a77 100644 --- a/src/logging.cpp +++ b/src/logging.cpp @@ -364,7 +364,8 @@ void BCLog::Logger::LogPrintStr(const std::string& str, const std::string& loggi } if (m_log_threadnames && m_started_new_line) { - str_prefixed.insert(0, "[" + util::ThreadGetInternalName() + "] "); + const auto threadname = util::ThreadGetInternalName(); + str_prefixed.insert(0, "[" + (threadname.empty() ? "unknown" : threadname) + "] "); } str_prefixed = LogTimestampStr(str_prefixed); -- cgit v1.2.3