aboutsummaryrefslogtreecommitdiffstats
path: root/src/core
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
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 '')
-rw-r--r--src/core/GpgCoreInit.cpp25
-rw-r--r--src/core/GpgCoreInit.h2
2 files changed, 17 insertions, 10 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;
diff --git a/src/core/GpgCoreInit.h b/src/core/GpgCoreInit.h
index 752fe4c3..150e85e9 100644
--- a/src/core/GpgCoreInit.h
+++ b/src/core/GpgCoreInit.h
@@ -37,7 +37,7 @@ namespace GpgFrontend {
* @brief
*
*/
-void init_logging();
+void GPGFRONTEND_CORE_EXPORT InitLoggingSystem();
/**
* @brief