Skip to content

Commit 3a171f7

Browse files
committed
logging: fix logging empty threadname
1 parent 345457b commit 3a171f7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/logging.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,8 @@ void BCLog::Logger::LogPrintStr(const std::string& str, const std::string& loggi
364364
}
365365

366366
if (m_log_threadnames && m_started_new_line) {
367-
str_prefixed.insert(0, "[" + util::ThreadGetInternalName() + "] ");
367+
const auto threadname = util::ThreadGetInternalName();
368+
str_prefixed.insert(0, "[" + (threadname.empty() ? "unknown" : threadname) + "] ");
368369
}
369370

370371
str_prefixed = LogTimestampStr(str_prefixed);

0 commit comments

Comments
 (0)