aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2021-04-18 19:05:03 -0400
committerRussell Yanofsky <russ@yanofsky.org>2021-04-19 06:11:38 -0400
commit5bed2ab42c4f1a820468f7005ce62e39001f6611 (patch)
tree23340ee04f41924e7dbd2fac82de58481419540d /src/init.cpp
parent1fb7fcfa52569a652d3ea55c210b725e60b7d86f (diff)
downloadbitcoin-5bed2ab42c4f1a820468f7005ce62e39001f6611.tar.xz
Move common logging start code to init/common
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp33
1 files changed, 3 insertions, 30 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 5708588e50..35c989d4e9 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1122,38 +1122,11 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
// Detailed error printed inside CreatePidFile().
return false;
}
- if (LogInstance().m_print_to_file) {
- if (args.GetBoolArg("-shrinkdebugfile", LogInstance().DefaultShrinkDebugFile())) {
- // Do this first since it both loads a bunch of debug.log into memory,
- // and because this needs to happen before any other debug.log printing
- LogInstance().ShrinkDebugFile();
- }
- }
- if (!LogInstance().StartLogging()) {
- return InitError(strprintf(Untranslated("Could not open debug log file %s"),
- LogInstance().m_file_path.string()));
- }
-
- if (!LogInstance().m_log_timestamps)
- LogPrintf("Startup time: %s\n", FormatISO8601DateTime(GetTime()));
- LogPrintf("Default data directory %s\n", GetDefaultDataDir().string());
- LogPrintf("Using data directory %s\n", GetDataDir().string());
-
- // Only log conf file usage message if conf file actually exists.
- fs::path config_file_path = GetConfigFile(args.GetArg("-conf", BITCOIN_CONF_FILENAME));
- if (fs::exists(config_file_path)) {
- LogPrintf("Config file: %s\n", config_file_path.string());
- } else if (args.IsArgSet("-conf")) {
- // Warn if no conf file exists at path provided by user
- InitWarning(strprintf(_("The specified config file %s does not exist"), config_file_path.string()));
- } else {
- // Not categorizing as "Warning" because it's the default behavior
- LogPrintf("Config file: %s (not found, skipping)\n", config_file_path.string());
+ if (!init::StartLogging(args)) {
+ // Detailed error printed inside StartLogging().
+ return false;
}
- // Log the config arguments to debug.log
- args.LogArgs();
-
LogPrintf("Using at most %i automatic connections (%i file descriptors available)\n", nMaxConnections, nFD);
// Warn about relative -datadir path.