Adapts logging
This commit is contained in:
@@ -24,45 +24,65 @@ void CreateInputTestLogger(el::Level level)
|
||||
conf.setToDefault();
|
||||
|
||||
conf.set(level, el::ConfigurationType::ToFile, "false");
|
||||
conf.set(level, el::ConfigurationType::Format, "%datetime [%level] [%func] : %msg");
|
||||
conf.set(level, el::ConfigurationType::Format, "%datetime [%level] [%fbase] : %msg");
|
||||
|
||||
el::Loggers::reconfigureAllLoggers(conf);
|
||||
}
|
||||
|
||||
el::Configurations createConfig(el::Level level)
|
||||
el::Configurations createConfig(std::string logger)
|
||||
{
|
||||
el::Configurations conf;
|
||||
conf.setToDefault();
|
||||
|
||||
conf.setGlobally(el::ConfigurationType::ToStandardOutput, "false");
|
||||
conf.setGlobally(el::ConfigurationType::MaxLogFileSize, "1500000"); //~1.5MB
|
||||
|
||||
conf.set(level, el::ConfigurationType::ToStandardOutput, "true");
|
||||
conf.set(level, el::ConfigurationType::ToFile, "true");
|
||||
conf.set(level, el::ConfigurationType::Filename, LOGGER_FILE);
|
||||
conf.set(level, el::ConfigurationType::Format, "%datetime [%level] [%func] : %msg");
|
||||
if (debug_log)
|
||||
{
|
||||
conf.set(el::Level::Debug, el::ConfigurationType::ToStandardOutput, "true");
|
||||
conf.set(el::Level::Debug, el::ConfigurationType::ToFile, "true");
|
||||
conf.set(el::Level::Debug, el::ConfigurationType::Format, "%datetime [%level] [%fbase] : %msg");
|
||||
conf.set(el::Level::Debug, el::ConfigurationType::Filename, LOGGER_FILE);
|
||||
}
|
||||
|
||||
conf.set(el::Level::Info, el::ConfigurationType::ToStandardOutput, "true");
|
||||
conf.set(el::Level::Info, el::ConfigurationType::ToFile, "true");
|
||||
conf.set(el::Level::Info, el::ConfigurationType::Filename, LOGGER_FILE);
|
||||
conf.set(el::Level::Info, el::ConfigurationType::Format, "%datetime [%level] [%fbase] : %msg");
|
||||
|
||||
conf.set(el::Level::Warning, el::ConfigurationType::ToStandardOutput, "true");
|
||||
conf.set(el::Level::Warning, el::ConfigurationType::ToFile, "true");
|
||||
conf.set(el::Level::Warning, el::ConfigurationType::Filename, LOGGER_FILE);
|
||||
conf.set(el::Level::Warning, el::ConfigurationType::Format, "%datetime [%level] [%fbase] : %msg");
|
||||
|
||||
conf.set(el::Level::Verbose, el::ConfigurationType::ToStandardOutput, "true");
|
||||
conf.set(el::Level::Verbose, el::ConfigurationType::ToFile, "true");
|
||||
conf.set(el::Level::Verbose, el::ConfigurationType::Filename, LOGGER_FILE);
|
||||
conf.set(el::Level::Verbose, el::ConfigurationType::Format, "%datetime [%level] [%fbase] : %msg");
|
||||
|
||||
return conf;
|
||||
}
|
||||
|
||||
void CreateInputLogger(el::Level level)
|
||||
void CreateInputLogger()
|
||||
{
|
||||
el::Loggers::getLogger(INPUT_LOGGER);
|
||||
|
||||
el::Configurations conf = createConfig(level);
|
||||
|
||||
el::Configurations conf = createConfig(INPUT_LOGGER);
|
||||
el::Loggers::reconfigureLogger(INPUT_LOGGER, conf);
|
||||
}
|
||||
|
||||
void CreateOutputLogger(el::Level level)
|
||||
void CreateOutputLogger()
|
||||
{
|
||||
el::Loggers::getLogger(OUTPUT_LOGGER);
|
||||
|
||||
el::Configurations conf = createConfig(level);
|
||||
|
||||
el::Configurations conf = createConfig(OUTPUT_LOGGER);
|
||||
el::Loggers::reconfigureLogger(OUTPUT_LOGGER, conf);
|
||||
}
|
||||
|
||||
};
|
||||
void ActivateDebugLog()
|
||||
{
|
||||
debug_log = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -17,11 +17,11 @@ namespace utility
|
||||
|
||||
namespace LoggerFactory
|
||||
{
|
||||
static bool debug_log = false;
|
||||
void CreateInputTestLogger(el::Level level = el::Level::Global);
|
||||
|
||||
void CreateInputLogger(el::Level level = el::Level::Info);
|
||||
|
||||
void CreateOutputLogger(el::Level level = el::Level::Info);
|
||||
void CreateInputLogger();
|
||||
void CreateOutputLogger();
|
||||
void ActivateDebugLog();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user