diff --git a/interfaces/innerkits/ipc_core/BUILD.gn b/interfaces/innerkits/ipc_core/BUILD.gn index 370a6abafe02f0c2912bf0f46b19dca228f381a6..6eaba0717870bda58bda1cbe41bd4214f09cffa8 100755 --- a/interfaces/innerkits/ipc_core/BUILD.gn +++ b/interfaces/innerkits/ipc_core/BUILD.gn @@ -62,6 +62,9 @@ ohos_shared_library("ipc_core") { "dsoftbus_standard:softbus_client", "hiviewdfx_hilog_native:libhilog", ] + public_deps = [ + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + ] subsystem_name = "communication" part_name = "ipc" } diff --git a/interfaces/innerkits/ipc_core/include/iremote_broker.h b/interfaces/innerkits/ipc_core/include/iremote_broker.h index 4251a993d8b0fc9f89adf787ffad2aa455a68e16..8d55ad5db58afb56e0771ace5d60f84bb9c01bc0 100755 --- a/interfaces/innerkits/ipc_core/include/iremote_broker.h +++ b/interfaces/innerkits/ipc_core/include/iremote_broker.h @@ -21,6 +21,18 @@ #include "iremote_object.h" #include "refbase.h" +#include +#include +#include +#include +constexpr OHOS::HiviewDFX::HiLogLabel IPC_LOG_LABEL = {LOG_CORE, 0, "ipcipc"}; +#define __IPC_LOG_(fmt, ...) \ + OHOS::HiviewDFX::HiLog::Info(IPC_LOG_LABEL, "%{public}s<%{public}d>" fmt, __func__, __LINE__, ##__VA_ARGS__) +static inline std::string to_utf8(std::u16string str16) +{ + return std::wstring_convert< std::codecvt_utf8_utf16, char16_t >{}.to_bytes(str16); +} + namespace OHOS { template class BrokerCreator { public: @@ -88,6 +100,7 @@ template BrokerDelegator::BrokerDelegator() { const std::u16string descriptor = T::GetDescriptor(); BrokerRegistration ®istration = BrokerRegistration::Get(); + __IPC_LOG_("%{public}s", to_utf8(descriptor).c_str()); registration.Register(descriptor, BrokerCreator()); } @@ -101,6 +114,7 @@ template BrokerDelegator::~BrokerDelegator() template inline sptr iface_cast(const sptr &object) { const std::u16string descriptor = INTERFACE::GetDescriptor(); + __IPC_LOG_("%{public}s", to_utf8(descriptor).c_str()); BrokerRegistration ®istration = BrokerRegistration::Get(); sptr broker = registration.NewInstance(descriptor, object); return static_cast(broker.GetRefPtr()); diff --git a/ipc/native/src/core/source/iremote_broker.cpp b/ipc/native/src/core/source/iremote_broker.cpp index 9a917fbbf4a4651d18965b89f2a92ed302892224..fdeb32c0308b481c485a07543b2ec001ddb51d5f 100755 --- a/ipc/native/src/core/source/iremote_broker.cpp +++ b/ipc/native/src/core/source/iremote_broker.cpp @@ -69,6 +69,7 @@ sptr BrokerRegistration::NewInstance(const std::u16string &descri auto it = creators_.find(descriptor); if (it != creators_.end()) { broker = it->second(object); + __IPC_LOG_("%{public}s found %{public}p", to_utf8(descriptor).c_str(), broker.GetRefPtr()); } } else { broker = object->AsInterface().GetRefPtr();