From d636ece26a9fdd1b3566cb15f4fa6a82ecd73e46 Mon Sep 17 00:00:00 2001 From: Master Date: Sat, 20 Jun 2020 20:25:45 -0400 Subject: [PATCH] dtype repair to logger --- examplar.cpp | 6 ++++-- src/Logger/Logger.cpp | 4 ++-- src/Logger/Logger.h | 4 ++-- src/loaders/abstract/Conf.cpp | 4 ++-- {conf => test}/config.json | 2 +- {conf => test}/plans/test.plan | 0 {conf => test}/units/all_test.units | 0 {conf => test}/units/dependent_tests.units | 0 8 files changed, 11 insertions(+), 9 deletions(-) rename {conf => test}/config.json (70%) rename {conf => test}/plans/test.plan (100%) rename {conf => test}/units/all_test.units (100%) rename {conf => test}/units/dependent_tests.units (100%) diff --git a/examplar.cpp b/examplar.cpp index 7f2c73c..551d499 100644 --- a/examplar.cpp +++ b/examplar.cpp @@ -39,7 +39,7 @@ int main( int argc, char * argv[] ) bool show_help = false; // indicator of whether examplar should use a commandline argument for overriding the context - // instead of what's supplied in the conf file + // instead of what's supplied in the test file bool cli_context_supplied = false; std::string config_path = "/etc/Examplar/config.json"; @@ -104,8 +104,10 @@ int main( int argc, char * argv[] ) if ( verbose ) { L_LEVEL = E_DEBUG; + std::cout << "Verbosity is DBUG." << std::endl; } else { L_LEVEL = E_INFO; + std::cout << "Verbosity is INFO." << std::endl; } Logger slog = Logger( L_LEVEL, "Examplar" ); @@ -126,7 +128,7 @@ int main( int argc, char * argv[] ) // if the user set this option as a commandline argument if ( cli_context_supplied ) { - // override the conf file's specified execution context + // override the test file's specified execution context configuration.set_execution_context( execution_context ); slog.log( E_DEBUG, "Set execution context from commandline: " + execution_context ); } diff --git a/src/Logger/Logger.cpp b/src/Logger/Logger.cpp index 7add3d4..d1a2508 100644 --- a/src/Logger/Logger.cpp +++ b/src/Logger/Logger.cpp @@ -7,10 +7,10 @@ Logger::Logger( int LOG_LEVEL, std::string mask ) { this->LOG_LEVEL = LOG_LEVEL; - this->mask = mask.c_str(); + this->mask = mask; setlogmask( LOG_UPTO( this->LOG_LEVEL ) ); - openlog( this->mask, LOG_CONS | LOG_PID | LOG_NDELAY, LOG_PERROR | LOG_LOCAL1 ); + openlog( this->mask.c_str(), LOG_CONS | LOG_PID | LOG_NDELAY, LOG_PERROR | LOG_LOCAL1 ); } diff --git a/src/Logger/Logger.h b/src/Logger/Logger.h index d2005bf..f82ff07 100644 --- a/src/Logger/Logger.h +++ b/src/Logger/Logger.h @@ -13,9 +13,9 @@ #include enum L_LVL { - E_INFO, E_FATAL, E_WARN, + E_INFO, E_DEBUG }; @@ -26,7 +26,7 @@ public: private: int LOG_LEVEL; - const char * mask; + std::string mask; std::string get_8601(); }; diff --git a/src/loaders/abstract/Conf.cpp b/src/loaders/abstract/Conf.cpp index 61f7c53..a8f3f01 100644 --- a/src/loaders/abstract/Conf.cpp +++ b/src/loaders/abstract/Conf.cpp @@ -66,7 +66,7 @@ protected: /// TODO Expand to detect when a directory path is supplied for units_path or plan_path and import all Tasks and Units. /// /// \param filename - The filename to load the configuration from. -Conf::Conf( std::string filename, int LOG_LEVEL ): JSON_Loader( LOG_LEVEL ), slog( LOG_LEVEL, "examplar::conf" ) +Conf::Conf( std::string filename, int LOG_LEVEL ): JSON_Loader( LOG_LEVEL ), slog( LOG_LEVEL, "examplar::test" ) { this->LOG_LEVEL = LOG_LEVEL; @@ -74,7 +74,7 @@ Conf::Conf( std::string filename, int LOG_LEVEL ): JSON_Loader( LOG_LEVEL ), slo this->override_context = false; try { - // load the conf file. + // load the test file. this->load_json_file( filename ); } catch (std::exception) { diff --git a/conf/config.json b/test/config.json similarity index 70% rename from conf/config.json rename to test/config.json index 709087a..8f6761e 100644 --- a/conf/config.json +++ b/test/config.json @@ -1,6 +1,6 @@ { "execution_context_override": true, - "execution_context": "/home/phanes/development/internal/Examplar/conf/", + "execution_context": "/home/bagira/development/internal/examplar/test", "units_path": "units/all_test.units", "plan_path": "plans/test.plan", "config_version": "3", diff --git a/conf/plans/test.plan b/test/plans/test.plan similarity index 100% rename from conf/plans/test.plan rename to test/plans/test.plan diff --git a/conf/units/all_test.units b/test/units/all_test.units similarity index 100% rename from conf/units/all_test.units rename to test/units/all_test.units diff --git a/conf/units/dependent_tests.units b/test/units/dependent_tests.units similarity index 100% rename from conf/units/dependent_tests.units rename to test/units/dependent_tests.units