diff options
author | Saturn&Eric <[email protected]> | 2022-05-20 19:13:55 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2022-05-20 19:13:55 +0000 |
commit | 306cc5b41af9596875c2999af638eaa35899e404 (patch) | |
tree | 6d8d5b3cdb35e79527d33c63d4e69995f9c3f2df /src/core/GpgCoreInit.cpp | |
parent | Merge pull request #65 from saturneric/develop-2.0.8 (diff) | |
parent | fix(ui): there is possible null pointer dereference (diff) | |
download | GpgFrontend-306cc5b41af9596875c2999af638eaa35899e404.tar.gz GpgFrontend-306cc5b41af9596875c2999af638eaa35899e404.zip |
Merge pull request #66 from saturneric/develop-2.0.8
Develop 2.0.8.2
Diffstat (limited to 'src/core/GpgCoreInit.cpp')
-rw-r--r-- | src/core/GpgCoreInit.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/core/GpgCoreInit.cpp b/src/core/GpgCoreInit.cpp index 41cf99cb..f1664b2a 100644 --- a/src/core/GpgCoreInit.cpp +++ b/src/core/GpgCoreInit.cpp @@ -28,8 +28,6 @@ #include "GpgCoreInit.h" -#include <memory> - #include "GpgFunctionObject.h" #include "core/GpgContext.h" #include "core/function/GlobalSettingStation.h" @@ -43,28 +41,37 @@ namespace GpgFrontend { * @brief setup logging system and do proper initialization * */ -void init_logging() { +void InitLoggingSystem() { using namespace boost::posix_time; using namespace boost::gregorian; - ptime now = second_clock::local_time(); - el::Loggers::addFlag(el::LoggingFlag::AutoSpacing); + el::Loggers::addFlag(el::LoggingFlag::ColoredTerminalOutput); + el::Loggers::addFlag(el::LoggingFlag::StrictLogFileSizeCheck); el::Configurations defaultConf; defaultConf.setToDefault(); - el::Loggers::reconfigureLogger("default", defaultConf); // apply settings defaultConf.setGlobally(el::ConfigurationType::Format, - "%datetime %level %func %msg"); + "%datetime %level [core] {%func} -> %msg"); + + // apply settings no written to file + defaultConf.setGlobally(el::ConfigurationType::ToFile, "false"); + + // set the logger + el::Loggers::reconfigureLogger("default", defaultConf); // get the log directory - auto logfile_path = - (GlobalSettingStation::GetInstance().GetLogDir() / to_iso_string(now)); + auto logfile_path = (GlobalSettingStation::GetInstance().GetLogDir() / + to_iso_string(second_clock::local_time())); logfile_path.replace_extension(".log"); defaultConf.setGlobally(el::ConfigurationType::Filename, logfile_path.u8string()); + // apply settings written to file + defaultConf.setGlobally(el::ConfigurationType::ToFile, "true"); + + // set the logger el::Loggers::reconfigureLogger("default", defaultConf); LOG(INFO) << _("log file path") << logfile_path; |