aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/GpgCoreInit.cpp
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2022-05-19 18:41:21 +0000
committerSaturneric <[email protected]>2022-05-19 18:41:21 +0000
commit6c884e583326b08aa7e354b47c18cdedaf9308f6 (patch)
tree4d3a198d9c13aca7693fe12571d961f1ba25b753 /src/core/GpgCoreInit.cpp
parentfix: solve user manual navbar.md link to downloads (diff)
downloadGpgFrontend-6c884e583326b08aa7e354b47c18cdedaf9308f6.tar.gz
GpgFrontend-6c884e583326b08aa7e354b47c18cdedaf9308f6.zip
perf: improve initialized and recover process
1. init logging system 2. init ui 3. init main
Diffstat (limited to 'src/core/GpgCoreInit.cpp')
-rw-r--r--src/core/GpgCoreInit.cpp25
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;