aboutsummaryrefslogtreecommitdiff
path: root/src/logging.cpp
diff options
context:
space:
mode:
authorklementtan <klementtan@gmail.com>2022-05-31 23:28:16 +0800
committerklementtan <klementtan@gmail.com>2022-06-02 22:30:30 +0800
commit3a171f742c31addf5a343e8a6905054a1fbb12aa (patch)
treeec39a698c3b860e2847d793eafe4aeef48ec5ce5 /src/logging.cpp
parent345457b542b6a980ccfbc868af0970a6f91d1b82 (diff)
logging: fix logging empty threadname
Diffstat (limited to 'src/logging.cpp')
-rw-r--r--src/logging.cpp3
1 files changed, 2 insertions, 1 deletions
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);