From 9b28b2d2746cba7dee1a200154e3e65b2809a432 Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Mon, 15 May 2017 09:26:29 +0100 Subject: [PATCH] Add a --show-paths switch to print hardcoded paths and info. --- src/tawashi/main.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/tawashi/main.cpp b/src/tawashi/main.cpp index d58b720..2ce0196 100644 --- a/src/tawashi/main.cpp +++ b/src/tawashi/main.cpp @@ -79,6 +79,23 @@ namespace { parSettings.add_default("logging_level", "err"); parSettings.add_default("resubmit_wait", "10"); } + + void print_buildtime_info() { + std::cout << "NDEBUG defined: "; +#if defined(NDEBUG) + std::cout << "yes (Release build)"; +#else + std::cout << "no (Debug build)"; +#endif + std::cout << '\n'; + std::cout << "TAWASHI_CONFIG_FILE: \"" << TAWASHI_CONFIG_FILE << "\"\n"; + std::cout << "TAWASHI_CONFIG_PATH: \"" << TAWASHI_CONFIG_PATH << "\"\n"; + std::cout << "TAWASHI_PATH_PREFIX: \"" << TAWASHI_PATH_PREFIX << "\"\n"; + std::cout << "VERSION_MAJOR: " << VERSION_MAJOR << '\n'; + std::cout << "VERSION_MINOR: " << VERSION_MINOR << '\n'; + std::cout << "VERSION_PATCH: " << VERSION_PATCH << '\n'; + std::cout << "config_file_path(): \"" << config_file_path() << "\"\n"; + } } //unnamed namespace int main (int parArgc, char* parArgv[], char* parEnvp[]) { @@ -89,6 +106,11 @@ int main (int parArgc, char* parArgv[], char* parEnvp[]) { using tawashi::ErrorResponse; using tawashi::Response; + if (2 == parArgc and boost::string_ref(parArgv[1]) == "--show-paths") { + print_buildtime_info(); + return 0; + } + //Prepare the logger spdlog::set_pattern("[%Y-%m-%d %T %z] - %v"); spdlog::set_level(spdlog::level::trace); //set to maximum possible here