Browse Source

initialize logger with loglevel as an argument

Former-commit-id: 3bac78a39c
tempestpy_adaptions
sjunges 9 years ago
parent
commit
ed94184ec8
  1. 8
      src/utility/initialize.cpp
  2. 1
      src/utility/initialize.h

8
src/utility/initialize.cpp

@ -9,13 +9,19 @@ log4cplus::Logger printer;
namespace storm {
namespace utility {
void initializeLogger() {
auto loglevel = storm::settings::debugSettings().isTraceSet() ? log4cplus::TRACE_LOG_LEVEL : storm::settings::debugSettings().isDebugSet() ? log4cplus::DEBUG_LOG_LEVEL : log4cplus::WARN_LOG_LEVEL;
initializeLogger(loglevel);
}
void initializeLogger(log4cplus::LogLevel const& loglevel) {
logger = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("main"));
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")));
logger.addAppender(consoleLogAppender);
auto loglevel = storm::settings::debugSettings().isTraceSet() ? log4cplus::TRACE_LOG_LEVEL : storm::settings::debugSettings().isDebugSet() ? log4cplus::DEBUG_LOG_LEVEL : log4cplus::WARN_LOG_LEVEL;
logger.setLogLevel(loglevel);
consoleLogAppender->setThreshold(loglevel);
}

1
src/utility/initialize.h

@ -20,6 +20,7 @@ namespace storm {
* Initializes the logging framework and sets up logging to console.
*/
void initializeLogger();
void initializeLogger(log4cplus::LogLevel const&);
/*!
* Performs some necessary initializations.

Loading…
Cancel
Save