Skip to content
Snippets Groups Projects
Commit 7aed5056 authored by pospelov's avatar pospelov
Browse files

New command line option for App --msgsvc=VERBOSE (INFO, DEBUG, …)

parent 048b6efe
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,7 @@
class ProgramOptions;
//! add command line and config file options
void AddApplicationOptions(ProgramOptions *p_options);
#endif // APPPROGRAMOPTIONS_H
......@@ -6,9 +6,7 @@
namespace bpo = boost::program_options;
/* ************************************************************************* */
// add command line and config file options
/* ************************************************************************* */
void AddApplicationOptions(ProgramOptions* p_options)
{
// general options
......
......@@ -58,7 +58,6 @@ void TestMiscellaneous::test_LogSystem()
log(MSG::WARNING) << "This is WARNING";
log(MSG::ERROR) << "This is ERROR";
log(MSG::FATAL) << "This is FATAL" << "and something" << 0;
log(MSG::ALWAYS) << "This is ALWAYS";
std::cout << "----" << std::endl;
......@@ -69,7 +68,6 @@ void TestMiscellaneous::test_LogSystem()
log(MSG::WARNING) << "This is WARNING";
log(MSG::ERROR) << "This is ERROR";
log(MSG::FATAL) << "This is FATAL";
log(MSG::ALWAYS) << "This is ALWAYS";
std::cout << "----" << std::endl;
......@@ -80,7 +78,6 @@ void TestMiscellaneous::test_LogSystem()
log(MSG::WARNING) << "This is WARNING";
log(MSG::ERROR) << "This is ERROR";
log(MSG::FATAL) << "This is FATAL";
log(MSG::ALWAYS) << "This is ALWAYS";
}
......
......@@ -25,15 +25,15 @@ int main(int argc, char **argv)
feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
#endif
std::cout << AppVersion::g_app_name << " "
<< AppVersion::g_app_version_number << std::endl;
MSG::SetLevel(MSG::ERROR);
<< AppVersion::g_app_version_number << std::endl;
ProgramOptions command_line_options;
AddApplicationOptions(&command_line_options);
AddCoreOptions(&command_line_options);
command_line_options.parseCommandLine(argc, argv);
MSG::SetLevel(command_line_options["msgsvc"].as<std::string>());
// setting graphics environment
TApplication *theApp(0);
if( command_line_options.find("batch") ) {
......
......@@ -20,6 +20,7 @@
#include "MultiLayerRoughnessDWBASimulation.h"
#include "DoubleToComplexMap.h"
#include "ExperimentConstants.h"
#include "MessageSvc.h"
MultiLayerDWBASimulation::MultiLayerDWBASimulation(
const MultiLayer* p_multi_layer) : mp_roughness_dwba_simulation(0)
......@@ -71,6 +72,7 @@ void MultiLayerDWBASimulation::setThreadInfo(const ThreadInfo &thread_info)
void MultiLayerDWBASimulation::run()
{
log(MSG::DEBUG) << "MultiLayerDWBASimulation::run() -> Running thread " << m_thread_info.i_thread;
OpticalFresnel fresnelCalculator;
kvector_t m_ki_real(m_ki.x().real(), m_ki.y().real(), m_ki.z().real());
......
......@@ -13,7 +13,7 @@
namespace MSG
{
enum MessageLevel { VERBOSE, DEBUG, INFO, WARNING, ERROR, FATAL, ALWAYS };
enum MessageLevel { VERBOSE, DEBUG, INFO, WARNING, ERROR, FATAL };
class Logger
......
......@@ -28,7 +28,9 @@ void AddCoreOptions(ProgramOptions *p_options)
bpo::options_description core_options("Core options");
core_options.add_options()
("threads", bpo::value<int>()->default_value(-1), "number of threads\n"
"arg<0 - no threads, arg=0 - system optimal, otherwise specified number of threads."
"arg<0 - no threads, arg=0 - system optimal, otherwise specified number of threads.")
("msgsvc", bpo::value<std::string>()->default_value("ERROR"), "Logging at one of the levels "
"VERBOSE, DEBUG, INFO, WARNING, ERROR, FATAL"
);
// adding options into main options holder
p_options->add(core_options);
......
......@@ -4,7 +4,7 @@
#include <sys/time.h>
std::vector<std::string> MSG::Logger::m_level_names =
boost::assign::list_of("VERBOSE")("DEBUG")("INFO")("WARNING")("ERROR")("FATAL")("ALWAYS");
boost::assign::list_of("VERBOSE")("DEBUG")("INFO")("WARNING")("ERROR")("FATAL");
MSG::MessageLevel MSG::Logger::m_logLevel = MSG::ERROR;
......@@ -28,7 +28,6 @@ void Logger::SetLevel(const std::string &levelname)
int index(0);
for(std::vector<std::string >::iterator it = m_level_names.begin(); it!=m_level_names.end(); ++it) {
if( (*it) == levelname ) {
std::cout << "AAA " << levelname << " " << index << std::endl;
SetLevel(MessageLevel(index));
return;
}
......
......@@ -35,7 +35,7 @@ const bpo::variable_value& ProgramOptions::operator[] (const std::string &s) con
// no consistent options, there reason might be that no call to parseConfigFile
// has been made (for example due to the absence of main())
//parseConfigFile();
throw LogicErrorException("ProgramOptions::operator[] -> FixMe! No config file parsed yet.");
//throw LogicErrorException("ProgramOptions::operator[] -> FixMe! No config file parsed yet.");
}
return m_variables_map[s.c_str()];
}
......@@ -79,7 +79,6 @@ void ProgramOptions::parseCommandLine(int argc, char **argv)
void ProgramOptions::parseConfigFile()
{
//std::cout << "ProgramOptions::parseConfigFile" << std::endl;
// default config file name
std::string config_file("bornagain.cfg");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment