Browse Source

Cleaned up handling of --verbose, proposing correct use of log levels from now on...

FATAL_LOG_LEVEL: Use, if we are going to crash.
ERROR_LOG_LEVEL: Use, if there is no reasonable way to continue.
WARN_LOG_LEVEL: Use, if we got something the average user should read.
INFO_LOG_LEVEL: Use, if this might in some cases be of interest.
DEBUG_LOG_LEVEL: Use, if this should usually not be relevant to a user.
TRACE_LOG_LEVEL: Use only during development.

There are three levels of verbosity:
- default: WARN and above
- verbose: INFO and above
- debug: DEBUG and above
tempestpy_adaptions
gereon 12 years ago
parent
commit
2bc32fe3de
  1. 19
      src/storm.cpp

19
src/storm.cpp

@ -44,7 +44,7 @@ log4cplus::Logger logger;
*/
void initializeLogger() {
logger = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("main"));
logger.setLogLevel(log4cplus::INFO_LOG_LEVEL);
logger.setLogLevel(log4cplus::WARN_LOG_LEVEL);
log4cplus::SharedAppenderPtr consoleLogAppender(new log4cplus::ConsoleAppender());
consoleLogAppender->setName("mainConsoleAppender");
consoleLogAppender->setLayout(std::auto_ptr<log4cplus::Layout>(new log4cplus::PatternLayout("%-5p - %D{%H:%M:%S} (%r ms) - %b:%L: %m%n")));
@ -111,18 +111,17 @@ bool parseOptions(const int argc, const char* argv[]) {
return false;
}
if (!s->isSet("verbose") && !s->isSet("logfile")) {
logger.setLogLevel(log4cplus::FATAL_LOG_LEVEL);
} else if (!s->isSet("verbose")) {
logger.removeAppender("mainConsoleAppender");
setUpFileLogging();
} else if (!s->isSet("logfile")) {
if (s->isSet("verbose")) {
logger.setLogLevel(log4cplus::INFO_LOG_LEVEL);
LOG4CPLUS_INFO(logger, "Enable verbose mode, log output gets printed to console.");
} else {
}
if (s->isSet("debug")) {
logger.setLogLevel(log4cplus::DEBUG_LOG_LEVEL);
LOG4CPLUS_INFO(logger, "Enable very verbose mode, log output gets printed to console.");
}
if (s->isSet("logfile")) {
setUpFileLogging();
LOG4CPLUS_INFO(logger, "Enable verbose mode, log output gets printed to console.");
}
return true;
}

Loading…
Cancel
Save