aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMacroFake <falke.marco@gmail.com>2022-06-03 08:46:40 +0200
committerMacroFake <falke.marco@gmail.com>2022-06-03 08:46:53 +0200
commit2cf8c2caea90d9a3c314ba5f88bb76b3b5273d62 (patch)
tree70ae57911f47b8d046254113b6920cdf5ff8c2d9 /src
parent00ce8543f16f4357926eb6dc701ac6229142be80 (diff)
parent3a171f742c31addf5a343e8a6905054a1fbb12aa (diff)
downloadbitcoin-2cf8c2caea90d9a3c314ba5f88bb76b3b5273d62.tar.xz
Merge bitcoin/bitcoin#25256: logging: fix logging empty thread name
3a171f742c31addf5a343e8a6905054a1fbb12aa logging: fix logging empty threadname (klementtan) Pull request description: Currently, `leveldb` background thread does not have a thread name and as a result, an empty thread name is logged. This PR fixes this by logging thread name as `"unknown"` if the thread name is empty On master: ```txt 2022-06-02T14:30:38Z [] [leveldb:debug] Generated table #281@0: 1862 keys, 138303 bytes ``` On this PR: ```txt 2022-06-02T14:30:38Z [unknown] [leveldb:debug] Generated table #281@0: 1862 keys, 138303 bytes ``` ACKs for top commit: laanwj: Code review ACK 3a171f742c31addf5a343e8a6905054a1fbb12aa hebasto: ACK 3a171f742c31addf5a343e8a6905054a1fbb12aa Tree-SHA512: 0af0fa5c4ddd3640c6dab9595fe9d97f74d0e0f4b41287a6630cf8ac5a21240250e0659ec4ac5a561e888d522f5304bf627104de2aba0fd0a86c1222de0897c2
Diffstat (limited to 'src')
-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);