aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@protonmail.com>2020-04-22 14:17:57 +0200
committerWladimir J. van der Laan <laanwj@protonmail.com>2020-04-22 14:18:06 +0200
commitacb4fa07416f37cfcf77dcafb26612845fd531a6 (patch)
treec8ef2eb11665cedf5e4585ed170d8f0ec508b1a0 /src
parent19032c750cb48338bd178fd785ed345e87235e2e (diff)
parentb91e4ae0d8ab2ae6b77585c97c52d825f56ed539 (diff)
downloadbitcoin-acb4fa07416f37cfcf77dcafb26612845fd531a6.tar.xz
Merge #18665: Do not expose and consider -logthreadnames when it does not work
b91e4ae0d8ab2ae6b77585c97c52d825f56ed539 Do not expose and consider -logthreadnames when it does not work (Hennadii Stepanov) Pull request description: There are conditions when the `HAVE_THREAD_LOCAL` macro is undefined what causes the `-logthreadnames` option does not work -- instead of thread names empty strings `[]` only are printed in the `debug.log` file. This PR does not exposes the `-logthreadnames` option in such cases. Refs: - #16059 - #18652 ACKs for top commit: MarcoFalke: ACK b91e4ae0d8ab2ae6b77585c97c52d825f56ed539, looked at the diff, didn't test Tree-SHA512: 3bd58e5ea603c69686589ddc94d6fa441cab4f712004378f2f1661e12638804ca03cfb6426e6393e55b6a095b325f3161d3c5371af05d7fc79d6d328227bf40c
Diffstat (limited to 'src')
-rw-r--r--src/init.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/init.cpp b/src/init.cpp
index de32c0ad71..83b3f2f47f 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -524,7 +524,11 @@ void SetupServerArgs(NodeContext& node)
gArgs.AddArg("-debugexclude=<category>", strprintf("Exclude debugging information for a category. Can be used in conjunction with -debug=1 to output debug logs for all categories except one or more specified categories."), ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
gArgs.AddArg("-logips", strprintf("Include IP addresses in debug output (default: %u)", DEFAULT_LOGIPS), ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
gArgs.AddArg("-logtimestamps", strprintf("Prepend debug output with timestamp (default: %u)", DEFAULT_LOGTIMESTAMPS), ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
+#ifdef HAVE_THREAD_LOCAL
gArgs.AddArg("-logthreadnames", strprintf("Prepend debug output with name of the originating thread (only available on platforms supporting thread_local) (default: %u)", DEFAULT_LOGTHREADNAMES), ArgsManager::ALLOW_ANY, OptionsCategory::DEBUG_TEST);
+#else
+ hidden_args.emplace_back("-logthreadnames");
+#endif
gArgs.AddArg("-logtimemicros", strprintf("Add microsecond precision to debug timestamps (default: %u)", DEFAULT_LOGTIMEMICROS), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
gArgs.AddArg("-mocktime=<n>", "Replace actual time with " + UNIX_EPOCH_TIME + " (default: 0)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
gArgs.AddArg("-maxsigcachesize=<n>", strprintf("Limit sum of signature cache and script execution cache sizes to <n> MiB (default: %u)", DEFAULT_MAX_SIG_CACHE_SIZE), ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
@@ -862,7 +866,9 @@ void InitLogging()
LogInstance().m_print_to_console = gArgs.GetBoolArg("-printtoconsole", !gArgs.GetBoolArg("-daemon", false));
LogInstance().m_log_timestamps = gArgs.GetBoolArg("-logtimestamps", DEFAULT_LOGTIMESTAMPS);
LogInstance().m_log_time_micros = gArgs.GetBoolArg("-logtimemicros", DEFAULT_LOGTIMEMICROS);
+#ifdef HAVE_THREAD_LOCAL
LogInstance().m_log_threadnames = gArgs.GetBoolArg("-logthreadnames", DEFAULT_LOGTHREADNAMES);
+#endif
fLogIPs = gArgs.GetBoolArg("-logips", DEFAULT_LOGIPS);