GpgFrontend Project
A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.
LoggerManager.h
1 
29 #pragma once
30 
31 #include "core/function/basic/GpgFunctionObject.h"
32 
33 namespace spdlog {
34 class logger;
35 }
36 
37 namespace GpgFrontend {
38 
39 class GPGFRONTEND_CORE_EXPORT LoggerManager
40  : public SingletonFunctionObject<LoggerManager> {
41  public:
42  explicit LoggerManager(int channel);
43 
44  ~LoggerManager() override;
45 
46  auto RegisterAsyncLogger(const QString& id, spdlog::level::level_enum)
47  -> std::shared_ptr<spdlog::logger>;
48 
49  auto RegisterSyncLogger(const QString& id, spdlog::level::level_enum)
50  -> std::shared_ptr<spdlog::logger>;
51 
52  auto GetLogger(const QString& id) -> std::shared_ptr<spdlog::logger>;
53 
54  static auto GetDefaultLogger() -> std::shared_ptr<spdlog::logger>;
55 
56  static void SetDefaultLogLevel(spdlog::level::level_enum);
57 
58  private:
59  static spdlog::level::level_enum default_log_level;
60  static std::shared_ptr<spdlog::logger> default_logger;
61 
62  std::map<QString, std::shared_ptr<spdlog::logger>> logger_map_;
63 };
64 
65 } // namespace GpgFrontend
Definition: LoggerManager.h:40
Definition: GpgFunctionObject.h:58
Definition: app.cpp:39
void RegisterAsyncLogger(const QString &id, spdlog::level::level_enum level)
Definition: LogUtils.cpp:51
auto GetLogger(const QString &id) -> std::shared_ptr< spdlog::logger >
Definition: LogUtils.cpp:43
auto GetDefaultLogger() -> std::shared_ptr< spdlog::logger >
Definition: LogUtils.cpp:35
void SetDefaultLogLevel(spdlog::level::level_enum level)
Set the Default Log Level object.
Definition: LogUtils.cpp:47
void RegisterSyncLogger(const QString &id, spdlog::level::level_enum level)
Definition: LogUtils.cpp:55
Definition: LoggerManager.h:33