aboutsummaryrefslogtreecommitdiffstats
path: root/src/module/sdk/Log.cpp
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2023-12-03 20:25:21 +0000
committersaturneric <[email protected]>2023-12-03 20:25:21 +0000
commit054e6e28cca2517dda2319ef683314b3318c39a6 (patch)
treeae9ff4a9fe280f3640ca249bad45ab250cfd1610 /src/module/sdk/Log.cpp
parentfix: slove issues in key/subkey generation (diff)
downloadGpgFrontend-054e6e28cca2517dda2319ef683314b3318c39a6.tar.gz
GpgFrontend-054e6e28cca2517dda2319ef683314b3318c39a6.zip
feat: standarized and speed up app env loading process
Diffstat (limited to '')
-rw-r--r--src/module/sdk/Log.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/module/sdk/Log.cpp b/src/module/sdk/Log.cpp
index 4d6620ff..b70f5bbb 100644
--- a/src/module/sdk/Log.cpp
+++ b/src/module/sdk/Log.cpp
@@ -33,6 +33,8 @@
#include <spdlog/sinks/rotating_file_sink.h>
#include <spdlog/sinks/stdout_color_sinks.h>
+#include <stdexcept>
+
#include "core/function/GlobalSettingStation.h"
namespace GpgFrontend::Module::SDK {
@@ -81,7 +83,13 @@ void ShutdownModuleLoggingSystem() {
#endif
}
-std::shared_ptr<spdlog::logger> GetModuleLogger() {
+auto GetModuleLogger() -> std::shared_ptr<spdlog::logger> {
+ // check if logging system is initalized
+ auto ptr = spdlog::get("module");
+ if (ptr == nullptr) {
+ throw std::runtime_error("logging system of modules is not initialized");
+ }
+
return spdlog::get("module");
}