diff options
Diffstat (limited to 'src/core/module')
-rw-r--r-- | src/core/module/Event.cpp | 5 | ||||
-rw-r--r-- | src/core/module/GlobalModuleContext.cpp | 45 | ||||
-rw-r--r-- | src/core/module/Module.cpp | 42 | ||||
-rw-r--r-- | src/core/module/ModuleInit.cpp | 8 | ||||
-rw-r--r-- | src/core/module/ModuleManager.cpp | 12 |
5 files changed, 52 insertions, 60 deletions
diff --git a/src/core/module/Event.cpp b/src/core/module/Event.cpp index b6d31369..873e728d 100644 --- a/src/core/module/Event.cpp +++ b/src/core/module/Event.cpp @@ -86,9 +86,8 @@ class Event::Impl { listener_id, data_object]() { callback(event_identifier, listener_id, data_object); })) { - qCWarning(core) << "failed to invoke callback for event: " - << event_identifier_ - << " with listener:" << listener_id; + LOG_W() << "failed to invoke callback for event: " << event_identifier_ + << " with listener:" << listener_id; } } } diff --git a/src/core/module/GlobalModuleContext.cpp b/src/core/module/GlobalModuleContext.cpp index 94165f88..08090d33 100644 --- a/src/core/module/GlobalModuleContext.cpp +++ b/src/core/module/GlobalModuleContext.cpp @@ -54,8 +54,7 @@ class GlobalModuleContext::Impl { // Search for the module in the register table. auto module_info_opt = search_module_register_table(module_id); if (!module_info_opt.has_value()) { - qCWarning(core) << "cannot find module id " << module_id - << " at register table"; + LOG_W() << "cannot find module id " << module_id << " at register table"; return nullptr; } @@ -67,10 +66,9 @@ class GlobalModuleContext::Impl { auto module_info_opt = search_module_register_table(module->GetModuleIdentifier()); if (!module_info_opt.has_value()) { - qCWarning(core) << "cannot find module id " - << module->GetModuleIdentifier() - << " at register table, fallback to " - "default channel"; + LOG_W() << "cannot find module id " << module->GetModuleIdentifier() + << " at register table, fallback to " + "default channel"; return GetDefaultChannel(module); } @@ -103,13 +101,13 @@ class GlobalModuleContext::Impl { if (module == nullptr || module_register_table_.find(module->GetModuleIdentifier()) != module_register_table_.end()) { - qCWarning(core, "module is null or have already registered this module"); + FLOG_W("module is null or have already registered this module"); return false; } if (module->Register() != 0) { - qCWarning(core) << "register module " << module->GetModuleIdentifier() - << " failed"; + LOG_W() << "register module " << module->GetModuleIdentifier() + << " failed"; return false; } @@ -136,8 +134,7 @@ class GlobalModuleContext::Impl { // Search for the module in the register table. auto module_info_opt = search_module_register_table(module_id); if (!module_info_opt.has_value()) { - qCWarning(core) << "cannot find module id " << module_id - << " at register table"; + LOG_W() << "cannot find module id " << module_id << " at register table"; return false; } @@ -146,8 +143,8 @@ class GlobalModuleContext::Impl { // try to get module from module info auto module = module_info->module; if (module == nullptr) { - qCWarning(core) << "module id:" << module_id - << " at register table is related to a null module"; + LOG_W() << "module id:" << module_id + << " at register table is related to a null module"; return false; } @@ -164,8 +161,7 @@ class GlobalModuleContext::Impl { // module -> event auto module_info_opt = search_module_register_table(module_id); if (!module_info_opt.has_value()) { - qCWarning(core) << "cannot find module id" << module_id - << "at register table"; + LOG_W() << "cannot find module id" << module_id << "at register table"; return false; } @@ -191,8 +187,7 @@ class GlobalModuleContext::Impl { // search for the module in the register table. auto module_info_opt = search_module_register_table(module_id); if (!module_info_opt.has_value()) { - qCWarning(core) << "cannot find module id " << module_id - << " at register table"; + LOG_W() << "cannot find module id " << module_id << " at register table"; return false; } @@ -220,8 +215,8 @@ class GlobalModuleContext::Impl { auto met_it = module_events_table_.find(event_id); if (met_it == module_events_table_.end()) { // Log a warning if the event is not registered and nobody is listening - qCInfo(core) << "event: " << event_id - << " is not listening by anyone and not registered as well."; + LOG_I() << "event: " << event_id + << " is not listening by anyone and not registered as well."; return false; } @@ -231,7 +226,7 @@ class GlobalModuleContext::Impl { // Check if the set of listeners is empty if (listeners_set.empty()) { // Log a warning if nobody is listening to this event - qCInfo(core) << "event: " << event_id << " is not listening by anyone"; + LOG_I() << "event: " << event_id << " is not listening by anyone"; return false; } @@ -245,8 +240,8 @@ class GlobalModuleContext::Impl { // Log an error if the module is not found in the registration table if (!module_info_opt.has_value()) { - qCWarning(core) << "cannot find module id: " << listener_module_id - << " at register table"; + LOG_W() << "cannot find module id: " << listener_module_id + << " at register table"; continue; } @@ -264,9 +259,9 @@ class GlobalModuleContext::Impl { [listener_module_id, event_id](int code, DataObjectPtr) { if (code < 0) { // Log an error if the module execution fails - qCWarning(core) << "module " << listener_module_id - << "execution failed of event " << event_id - << ": exec return code: " << code; + LOG_W() << "module " << listener_module_id + << "execution failed of event " << event_id + << ": exec return code: " << code; } }; diff --git a/src/core/module/Module.cpp b/src/core/module/Module.cpp index 2358d108..becda4b6 100644 --- a/src/core/module/Module.cpp +++ b/src/core/module/Module.cpp @@ -59,9 +59,9 @@ class Module::Impl { *required_symbol.pointer = reinterpret_cast<void*>(module_library.resolve(required_symbol.name)); if (*required_symbol.pointer == nullptr) { - qCWarning(core) << "illegal module: " << module_library.fileName() - << ", reason cannot load symbol: " - << required_symbol.name << ", abort..."; + LOG_W() << "illegal module: " << module_library.fileName() + << ", reason cannot load symbol: " << required_symbol.name + << ", abort..."; return; } } @@ -72,38 +72,36 @@ class Module::Impl { qt_env_ver_ = GFUnStrDup(get_qt_ver_api_()); if (!module_identifier_regex_exp_.match(identifier_).hasMatch()) { - qCWarning(core) << "illegal module: " << identifier_ - << ", reason invalid module id, abort..."; + LOG_W() << "illegal module: " << identifier_ + << ", reason invalid module id, abort..."; return; } if (!module_version_regex_exp_.match(version_).hasMatch()) { - qCWarning(core) << "illegal module: " << identifier_ - << ", reason invalid version: " << version_ - << ", abort..."; + LOG_W() << "illegal module: " << identifier_ + << ", reason invalid version: " << version_ << ", abort..."; return; } if (!module_version_regex_exp_.match(gf_sdk_ver_).hasMatch()) { - qCWarning(core) << "illegal module: " << identifier_ - << ", reason invalid sdk version: " << gf_sdk_ver_ - << ", abort..."; + LOG_W() << "illegal module: " << identifier_ + << ", reason invalid sdk version: " << gf_sdk_ver_ + << ", abort..."; return; } if (GFCompareSoftwareVersion(gf_sdk_ver_, GetProjectVersion()) > 0) { - qCWarning(core) << "uncompatible module: " << identifier_ - << ", reason sdk version: " << gf_sdk_ver_ - << "current sdk version: " << GetProjectVersion() - << ", abort..."; + LOG_W() << "uncompatible module: " << identifier_ + << ", reason sdk version: " << gf_sdk_ver_ + << "current sdk version: " << GetProjectVersion() << ", abort..."; return; } auto qt_env_ver_regex_match = module_version_regex_exp_.match(qt_env_ver_); if (!qt_env_ver_regex_match.hasMatch()) { - qCWarning(core) << "illegal module: " << identifier_ - << ", reason invalid qt env version: " << qt_env_ver_ - << ", abort..."; + LOG_W() << "illegal module: " << identifier_ + << ", reason invalid qt env version: " << qt_env_ver_ + << ", abort..."; return; } @@ -112,10 +110,10 @@ class Module::Impl { if (qt_env_ver_major != QString::number(QT_VERSION_MAJOR) + "." || qt_env_ver_minor != QString::number(QT_VERSION_MINOR) + ".") { - qCWarning(core) << "uncompatible module: " << identifier_ - << ", reason sdk version: " << qt_env_ver_ - << "current sdk version: " - << QString::fromUtf8(QT_VERSION_STR) << ", abort..."; + LOG_W() << "uncompatible module: " << identifier_ + << ", reason sdk version: " << qt_env_ver_ + << "current sdk version: " << QString::fromUtf8(QT_VERSION_STR) + << ", abort..."; return; } diff --git a/src/core/module/ModuleInit.cpp b/src/core/module/ModuleInit.cpp index 4fedc6c7..3c71a45b 100644 --- a/src/core/module/ModuleInit.cpp +++ b/src/core/module/ModuleInit.cpp @@ -69,8 +69,8 @@ auto LoadIntegratedMods() -> bool { #endif if (!QDir(mods_path).exists()) { - qCWarning(core) << "integrated module directory at path: " << mods_path - << " not found, abort..."; + LOG_W() << "integrated module directory at path: " << mods_path + << " not found, abort..."; return false; } @@ -84,8 +84,8 @@ auto LoadExternalMods() -> bool { GpgFrontend::GlobalSettingStation::GetInstance().GetModulesDir(); if (!QDir(mods_path).exists()) { - qCWarning(core) << "external module directory at path " << mods_path - << " not found, abort..."; + LOG_W() << "external module directory at path " << mods_path + << " not found, abort..."; return false; } diff --git a/src/core/module/ModuleManager.cpp b/src/core/module/ModuleManager.cpp index f2318543..5f8895be 100644 --- a/src/core/module/ModuleManager.cpp +++ b/src/core/module/ModuleManager.cpp @@ -69,17 +69,17 @@ class ModuleManager::Impl { [=](GpgFrontend::DataObjectPtr) -> int { QLibrary module_library(module_library_path); if (!module_library.load()) { - qCWarning(core) << "module manager failed to load module: " - << module_library.fileName() - << ", reason: " << module_library.errorString(); + LOG_W() << "module manager failed to load module: " + << module_library.fileName() + << ", reason: " << module_library.errorString(); return -1; } auto module = SecureCreateSharedObject<Module>(module_library); if (!module->IsGood()) { - qCWarning(core) << "module manager failed to load module, " - "reason: illegal module: " - << module_library.fileName(); + LOG_W() << "module manager failed to load module, " + "reason: illegal module: " + << module_library.fileName(); return -1; } |