From b6fe9863c7e224bb7677262f76af93aa345b5150 Mon Sep 17 00:00:00 2001 From: Karol Grydziuszko Date: Fri, 31 Dec 2021 11:36:27 +0100 Subject: [PATCH] Changed dependency from libhilog to libhilog_base. Signed-off-by: Karol Grydziuszko Change-Id: Ie10abb8c5aba8c6b287fe2fb3b384b2c106dca3a --- interfaces/innerkits/lsamgr/BUILD.gn | 2 +- interfaces/innerkits/samgr_proxy/BUILD.gn | 2 +- .../innerkits/samgr_proxy/include/sam_log.h | 19 ++++++++----------- .../include/local_ability_manager_proxy.h | 2 -- .../src/local_ability_manager_proxy.cpp | 15 +++++++++------ services/samgr/native/BUILD.gn | 3 +-- .../samgr/native/source/service_registry.cpp | 14 +++++++++----- 7 files changed, 29 insertions(+), 28 deletions(-) diff --git a/interfaces/innerkits/lsamgr/BUILD.gn b/interfaces/innerkits/lsamgr/BUILD.gn index 932b647b..67f58589 100755 --- a/interfaces/innerkits/lsamgr/BUILD.gn +++ b/interfaces/innerkits/lsamgr/BUILD.gn @@ -30,7 +30,7 @@ ohos_shared_library("lsamgr") { configs = [ ":config_samgr" ] if (is_standard_system) { external_deps = [ - "hiviewdfx_hilog_native:libhilog", + "hiviewdfx_hilog_native:libhilog_base", "ipc:ipc_core", ] part_name = "samgr_standard" diff --git a/interfaces/innerkits/samgr_proxy/BUILD.gn b/interfaces/innerkits/samgr_proxy/BUILD.gn index 47f0b41b..035a9393 100755 --- a/interfaces/innerkits/samgr_proxy/BUILD.gn +++ b/interfaces/innerkits/samgr_proxy/BUILD.gn @@ -48,7 +48,7 @@ ohos_shared_library("samgr_proxy") { if (is_standard_system) { external_deps = [ - "hiviewdfx_hilog_native:libhilog", + "hiviewdfx_hilog_native:libhilog_base", "ipc:ipc_core", ] diff --git a/interfaces/innerkits/samgr_proxy/include/sam_log.h b/interfaces/innerkits/samgr_proxy/include/sam_log.h index f8b202ac..9921979c 100644 --- a/interfaces/innerkits/samgr_proxy/include/sam_log.h +++ b/interfaces/innerkits/samgr_proxy/include/sam_log.h @@ -16,14 +16,9 @@ #ifndef SERVICES_SAMGR_NATIVE_INCLUDE_SAM_LOG_H_ #define SERVICES_SAMGR_NATIVE_INCLUDE_SAM_LOG_H_ -#include "hilog/log.h" +#include "hilog_base/log_base.h" namespace OHOS { -static constexpr OHOS::HiviewDFX::HiLogLabel SYSTEM_ABLILITY_MGR_LABEL = { - LOG_CORE, - 0xD001800, - "SAMGR" -}; #ifdef HILOGF #undef HILOGF @@ -45,11 +40,13 @@ static constexpr OHOS::HiviewDFX::HiLogLabel SYSTEM_ABLILITY_MGR_LABEL = { #undef HILOGD #endif -#define HILOGF(...) (void)OHOS::HiviewDFX::HiLog::Fatal(SYSTEM_ABLILITY_MGR_LABEL, __VA_ARGS__) -#define HILOGE(...) (void)OHOS::HiviewDFX::HiLog::Error(SYSTEM_ABLILITY_MGR_LABEL, __VA_ARGS__) -#define HILOGW(...) (void)OHOS::HiviewDFX::HiLog::Warn(SYSTEM_ABLILITY_MGR_LABEL, __VA_ARGS__) -#define HILOGI(...) (void)OHOS::HiviewDFX::HiLog::Info(SYSTEM_ABLILITY_MGR_LABEL, __VA_ARGS__) -#define HILOGD(...) (void)OHOS::HiviewDFX::HiLog::Debug(SYSTEM_ABLILITY_MGR_LABEL, __VA_ARGS__) +#define SAMGR_LOG(level, ...) HiLogBasePrint(LOG_CORE, level, 0xD001800, "SAMGR", ##__VA_ARGS__) + +#define HILOGF(...) SAMGR_LOG(LOG_FATAL, ##__VA_ARGS__) +#define HILOGE(...) SAMGR_LOG(LOG_ERROR, ##__VA_ARGS__) +#define HILOGW(...) SAMGR_LOG(LOG_WARN, ##__VA_ARGS__) +#define HILOGI(...) SAMGR_LOG(LOG_INFO, ##__VA_ARGS__) +#define HILOGD(...) SAMGR_LOG(LOG_DEBUG, ##__VA_ARGS__) } // namespace OHOS #endif // #ifndef SERVICES_SAMGR_NATIVE_INCLUDE_SAM_LOG_H_ diff --git a/services/lsamgr/include/local_ability_manager_proxy.h b/services/lsamgr/include/local_ability_manager_proxy.h index 647b7f10..733ebc42 100755 --- a/services/lsamgr/include/local_ability_manager_proxy.h +++ b/services/lsamgr/include/local_ability_manager_proxy.h @@ -18,7 +18,6 @@ #include #include "if_local_ability_manager.h" -#include "hilog/log.h" namespace OHOS { class LocalAbilityManagerProxy : public IRemoteProxy { @@ -30,7 +29,6 @@ public: bool StartAbility(int32_t saId); private: static inline BrokerDelegator delegator_; - OHOS::HiviewDFX::HiLogLabel label_ = { LOG_CORE, 0xD001800, "SA" }; }; } #endif // !defined(LOCAL_ABILITY_MANAGER_PROXY_H_) diff --git a/services/lsamgr/src/local_ability_manager_proxy.cpp b/services/lsamgr/src/local_ability_manager_proxy.cpp index e5be03b7..f8136993 100755 --- a/services/lsamgr/src/local_ability_manager_proxy.cpp +++ b/services/lsamgr/src/local_ability_manager_proxy.cpp @@ -16,32 +16,35 @@ #include "local_ability_manager_proxy.h" #include "ipc_types.h" #include "parcel.h" +#include "hilog_base/log_base.h" using namespace std; -using namespace OHOS::HiviewDFX; + +#define HiLogBase(level, fmt, args...) \ + (void)HiLogBasePrint(LOG_CORE, level, 0xD001800, "SA", fmt, ##args) namespace OHOS { bool LocalAbilityManagerProxy::StartAbility(int32_t systemAbilityId) { if (systemAbilityId <= 0) { - HiLog::Warn(label_, "StartAbility systemAbilityId invalid."); + HiLogBase(LOG_WARN, "StartAbility systemAbilityId invalid."); return false; } sptr iro = Remote(); if (iro == nullptr) { - HiLog::Error(label_, "StartAbility Remote return null"); + HiLogBase(LOG_ERROR, "StartAbility Remote return null"); return false; } MessageParcel data; if (!data.WriteInterfaceToken(LOCAL_ABILITY_MANAGER_INTERFACE_TOKEN)) { - HiLog::Warn(label_, "StartAbility interface token check failed"); + HiLogBase(LOG_WARN, "StartAbility interface token check failed"); return false; } bool ret = data.WriteInt32(systemAbilityId); if (!ret) { - HiLog::Warn(label_, "StartAbility write systemAbilityId failed!"); + HiLogBase(LOG_WARN, "StartAbility write systemAbilityId failed!"); return false; } @@ -49,7 +52,7 @@ bool LocalAbilityManagerProxy::StartAbility(int32_t systemAbilityId) MessageOption option(MessageOption::TF_ASYNC); int32_t status = iro->SendRequest(START_ABILITY_TRANSACTION, data, reply, option); if (status != NO_ERROR) { - HiLog::Error(label_, "StartAbility SendRequest failed, return value : %{public}d", status); + HiLogBase(LOG_ERROR, "StartAbility SendRequest failed, return value : %{public}d", status); return false; } return true; diff --git a/services/samgr/native/BUILD.gn b/services/samgr/native/BUILD.gn index b8433036..04fc7e6d 100755 --- a/services/samgr/native/BUILD.gn +++ b/services/samgr/native/BUILD.gn @@ -19,7 +19,6 @@ config("distributed_store_config") { include_dirs = [ "//foundation/distributedschedule/samgr/services/samgr/native/include", "//third_party/json/include", - "//foundation/distributedschedule/dmsfwk/services/dtbdecidefwk/include", ] } @@ -78,7 +77,7 @@ ohos_executable("samgr") { if (is_standard_system) { external_deps = [ "eventhandler:libeventhandler", - "hiviewdfx_hilog_native:libhilog", + "hiviewdfx_hilog_native:libhilog_base", "ipc:ipc_core", "ipc:libdbinder", ] diff --git a/services/samgr/native/source/service_registry.cpp b/services/samgr/native/source/service_registry.cpp index 7e841142..e2634d3e 100755 --- a/services/samgr/native/source/service_registry.cpp +++ b/services/samgr/native/source/service_registry.cpp @@ -21,14 +21,20 @@ #include "ipc_skeleton.h" #include "ipc_types.h" #include "parcel.h" -#include "parcel_helper.h" - #include "sam_log.h" #include "string_ex.h" #include "system_ability_manager_proxy.h" +#define PARCEL_WRITE_HELPER_RET(parcel, type, value, failRet) \ + do { \ + bool ret = parcel.Write##type((value)); \ + if (!ret) { \ + HILOGE("%{public}s write value failed!", __func__); \ + return failRet; \ + } \ + } while (0) + namespace OHOS { -using namespace OHOS::HiviewDFX; namespace { constexpr int32_t MASK = 0x100; @@ -113,8 +119,6 @@ public: return err; } -private: - static constexpr HiLogLabel LABEL = { LOG_CORE, 0xD001800, "ServiceRegistry" }; }; std::mutex ServiceRegistry::serviceRegistryLock_; -- Gitee