diff --git a/base/BUILD.gn b/base/BUILD.gn index cdf421d1b29be4186a6c9c683eee990fc1d74fe6..883b1ec272aa93b1da336cdce9a54b61402b927c 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn @@ -110,7 +110,7 @@ ohos_static_library("utilsbase") { ] public_configs = [ ":static_utils_config" ] defines = [ "CONFIG_HILOG" ] - external_deps = [ "hilog_native:libhilog" ] + external_deps = [ "hilog_native:libhilog_base" ] } ohos_shared_library("utils") { @@ -123,7 +123,7 @@ ohos_shared_library("utils") { public_configs = [ ":static_utils_config" ] subsystem_name = "utils" defines = [ "CONFIG_HILOG" ] - external_deps = [ "hilog_native:libhilog" ] + external_deps = [ "hilog_native:libhilog_base" ] part_name = "utils_base" install_images = [ "system", diff --git a/base/src/utils_log.h b/base/src/utils_log.h index 7c2386c630b91c32c2f73a459fe323dddda91d4f..9fda24fec1f9b0cb008167a862639f2f57af86fa 100644 --- a/base/src/utils_log.h +++ b/base/src/utils_log.h @@ -16,13 +16,15 @@ #define UTILS_BASE_LOG_H #ifdef CONFIG_HILOG -#include "hilog/log.h" -static constexpr OHOS::HiviewDFX::HiLogLabel label = { LOG_CORE, 0xD003D00, "utils_base" }; -#define UTILS_LOGF(...) (void)OHOS::HiviewDFX::HiLog::Fatal(label, __VA_ARGS__) -#define UTILS_LOGE(...) (void)OHOS::HiviewDFX::HiLog::Error(label, __VA_ARGS__) -#define UTILS_LOGW(...) (void)OHOS::HiviewDFX::HiLog::Warn(label, __VA_ARGS__) -#define UTILS_LOGI(...) (void)OHOS::HiviewDFX::HiLog::Info(label, __VA_ARGS__) -#define UTILS_LOGD(...) (void)OHOS::HiviewDFX::HiLog::Debug(label, __VA_ARGS__) +#include "hilog_base/log_base.h" +constexpr LogType UTILS_LOG_TYPE = LOG_CORE; +constexpr unsigned int UTILS_LOG_DOMAIN = 0xD003D00; +constexpr const char *UTILS_LOG_TAG = "utils_base"; +#define UTILS_LOGF(...) (void)HiLogBasePrint(UTILS_LOG_TYPE, LOG_FATAL, UTILS_LOG_DOMAIN, UTILS_LOG_TAG, __VA_ARGS__) +#define UTILS_LOGE(...) (void)HiLogBasePrint(UTILS_LOG_TYPE, LOG_ERROR, UTILS_LOG_DOMAIN, UTILS_LOG_TAG, __VA_ARGS__) +#define UTILS_LOGW(...) (void)HiLogBasePrint(UTILS_LOG_TYPE, LOG_WARN, UTILS_LOG_DOMAIN, UTILS_LOG_TAG, __VA_ARGS__) +#define UTILS_LOGI(...) (void)HiLogBasePrint(UTILS_LOG_TYPE, LOG_INFO, UTILS_LOG_DOMAIN, UTILS_LOG_TAG, __VA_ARGS__) +#define UTILS_LOGD(...) (void)HiLogBasePrint(UTILS_LOG_TYPE, LOG_DEBUG, UTILS_LOG_DOMAIN, UTILS_LOG_TAG, __VA_ARGS__) #else #define UTILS_LOGF(...) #define UTILS_LOGE(...) @@ -32,12 +34,19 @@ static constexpr OHOS::HiviewDFX::HiLogLabel label = { LOG_CORE, 0xD003D00, "uti #endif // CONFIG_HILOG #if (defined CONFIG_HILOG) && (defined CONFIG_PARCEL_DEBUG) -static constexpr OHOS::HiviewDFX::HiLogLabel parcelLabel = { LOG_CORE, 0xD003D01, "parcel" }; -#define PARCEL_LOGF(...) (void)OHOS::HiviewDFX::HiLog::Fatal(parcelLabel, __VA_ARGS__) -#define PARCEL_LOGE(...) (void)OHOS::HiviewDFX::HiLog::Error(parcelLabel, __VA_ARGS__) -#define PARCEL_LOGW(...) (void)OHOS::HiviewDFX::HiLog::Warn(parcelLabel, __VA_ARGS__) -#define PARCEL_LOGI(...) (void)OHOS::HiviewDFX::HiLog::Info(parcelLabel, __VA_ARGS__) -#define PARCEL_LOGD(...) (void)OHOS::HiviewDFX::HiLog::Debug(parcelLabel, __VA_ARGS__) +constexpr LogType PARCEL_LOG_TYPE = LOG_CORE; +constexpr unsigned int PARCEL_LOG_DOMAIN = 0xD003D01; +constexpr const char *PARCEL_LOG_TAG = "parcel"; +#define PARCEL_LOGF(...) \ + (void)HiLogBasePrint(PARCEL_LOG_TYPE, LOG_FATAL, PARCEL_LOG_DOMAIN, PARCEL_LOG_TAG, __VA_ARGS__) +#define PARCEL_LOGE(...) \ + (void)HiLogBasePrint(PARCEL_LOG_TYPE, LOG_ERROR, PARCEL_LOG_DOMAIN, PARCEL_LOG_TAG, __VA_ARGS__) +#define PARCEL_LOGW(...) \ + (void)HiLogBasePrint(PARCEL_LOG_TYPE, LOG_WARN, PARCEL_LOG_DOMAIN, PARCEL_LOG_TAG, __VA_ARGS__) +#define PARCEL_LOGI(...) \ + (void)HiLogBasePrint(PARCEL_LOG_TYPE, LOG_INFO, PARCEL_LOG_DOMAIN, PARCEL_LOG_TAG, __VA_ARGS__) +#define PARCEL_LOGD(...) \ + (void)HiLogBasePrint(PARCEL_LOG_TYPE, LOG_DEBUG, PARCEL_LOG_DOMAIN, PARCEL_LOG_TAG, __VA_ARGS__) #else #define PARCEL_LOGF(...) #define PARCEL_LOGE(...) diff --git a/ohos.build b/ohos.build index 181551b0cbffeb12d91b108ef6a62754c3b5fa05..b671cb193dc8bb311d1f14a638037e6ffa95aef2 100644 --- a/ohos.build +++ b/ohos.build @@ -5,7 +5,8 @@ "module_list": [ "//utils/native/base:utils", "//utils/native/ndk_libraries_config:ndk_libs_config", - "//utils/native/base:utilsecurec_shared" + "//utils/native/base:utilsecurec_shared", + "//third_party/bounds_checking_function:libsec_shared" ], "inner_kits": [ {