From 615965cfd1ef1e0627d69970d99bdfedb9176833 Mon Sep 17 00:00:00 2001 From: Russell Yanofsky Date: Sun, 18 Apr 2021 19:07:13 -0400 Subject: [PATCH] Move common package version code to init/common --- src/init.cpp | 9 +-------- src/init/common.cpp | 12 ++++++++++++ src/init/common.h | 1 + 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 35c989d4e9a..4760d8c4ab0 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -756,14 +756,7 @@ void InitParameterInteraction(ArgsManager& args) void InitLogging(const ArgsManager& args) { init::SetLoggingOptions(args); - - std::string version_string = FormatFullVersion(); -#ifdef DEBUG - version_string += " (debug build)"; -#else - version_string += " (release build)"; -#endif - LogPrintf(PACKAGE_NAME " version %s\n", version_string); + init::LogPackageVersion(); } namespace { // Variables internal to initialization process only diff --git a/src/init/common.cpp b/src/init/common.cpp index 35776080dca..79e0c9da782 100644 --- a/src/init/common.cpp +++ b/src/init/common.cpp @@ -6,6 +6,7 @@ #include #endif +#include #include #include #include @@ -152,4 +153,15 @@ bool StartLogging(const ArgsManager& args) return true; } + +void LogPackageVersion() +{ + std::string version_string = FormatFullVersion(); +#ifdef DEBUG + version_string += " (debug build)"; +#else + version_string += " (release build)"; +#endif + LogPrintf(PACKAGE_NAME " version %s\n", version_string); +} } // namespace init diff --git a/src/init/common.h b/src/init/common.h index 91a7282d105..fc4bc1b2800 100644 --- a/src/init/common.h +++ b/src/init/common.h @@ -22,6 +22,7 @@ void AddLoggingArgs(ArgsManager& args); void SetLoggingOptions(const ArgsManager& args); void SetLoggingCategories(const ArgsManager& args); bool StartLogging(const ArgsManager& args); +void LogPackageVersion(); } // namespace init #endif // BITCOIN_INIT_COMMON_H