fix: use lite and small using hilog

Signed-off-by: aqxyjay <zhangchunxin@huawei.com>
(cherry picked from commit 4318b0d342)
This commit is contained in:
aqxyjay 2024-01-15 16:55:13 +08:00
parent 95b97eae26
commit afd55f318a
19 changed files with 131 additions and 99 deletions

View File

@ -29,6 +29,7 @@ if (defined(ohos_lite)) {
"$softbus_adapter_config/spec_config",
"$dsoftbus_root_path/core/common/include",
"$hilog_lite_include_path",
"$utils_lite_include_path",
]
if (board_name == "v200zr") {
defines += [ "DSOFTBUS_V200ZR" ]

View File

@ -59,6 +59,7 @@ if (defined(ohos_lite)) {
"$NSTACKX_ROOT/nstackx_core/",
"//third_party/bounds_checking_function/include/",
"$hilog_lite_include_path",
"$utils_lite_include_path",
]
sources = [
"core/nstackx_event.c",
@ -100,6 +101,7 @@ if (defined(ohos_lite)) {
"$NSTACKX_ROOT/nstackx_core/",
"//third_party/bounds_checking_function/include/",
"$hilog_lite_include_path",
"$utils_lite_include_path",
]
sources = [
"core/nstackx_dev.c",
@ -138,6 +140,7 @@ if (defined(ohos_lite)) {
"$NSTACKX_ROOT/nstackx_core/",
"//third_party/bounds_checking_function/include/",
"$hilog_lite_include_path",
"$utils_lite_include_path",
]
sources = [
"core/nstackx_dev.c",

View File

@ -61,6 +61,7 @@ if (defined(ohos_lite)) {
"$dsoftbus_root_path/core/common/dfx/interface/include",
"$softbus_adapter_common/include",
"$hilog_lite_include_path",
"$utils_lite_include_path",
]
include_dirs += conn_common_inc + trans_common_inc
if (board_toolchain_type != "iccarm") {
@ -95,12 +96,12 @@ if (defined(ohos_lite)) {
]
}
if (ohos_kernel_type == "liteos_m") {
defines += [ "SOFTBUS_MINI_SYSTEM" ]
defines += [ "SOFTBUS_LITEOS_M" ]
defines += [ "__STDC_FORMAT_MACROS" ]
} else {
defines += [ "DEFAULT_STORAGE_PATH=\"/storage/data\"" ]
defines += [ "__STDC_FORMAT_MACROS" ]
defines += [ "SOFTBUS_SMALL_SYSTEM" ]
defines += [ "SOFTBUS_LITEOS_A" ]
}
deps = [
"$dsoftbus_dfx_path/anonymize:softbus_dfx_anonymizer",

View File

@ -30,6 +30,7 @@ if (defined(ohos_lite)) {
"$dsoftbus_dfx_path/interface/include",
"$dsoftbus_root_path/interfaces/kits/common",
"$hilog_lite_include_path",
"$utils_lite_include_path",
]
cflags = ohos_lite_cflags
cflags_cc = ohos_lite_cflags

View File

@ -16,9 +16,18 @@ import("../../../dsoftbus.gni")
dsoftbus_dfx_path = "$dsoftbus_core_path/common/dfx"
if (defined(ohos_lite)) {
hilog_lite_include_path = "//base/hiviewdfx/hilog_lite/interfaces/native/kits"
hilog_lite_deps_path =
"//base/hiviewdfx/hilog_lite/frameworks/mini:hilog_lite"
if (ohos_kernel_type == "liteos_m") {
hilog_lite_include_path =
"//base/hiviewdfx/hilog_lite/interfaces/native/kits"
hilog_lite_deps_path =
"//base/hiviewdfx/hilog_lite/frameworks/mini:hilog_lite"
} else {
hilog_lite_include_path =
"//base/hiviewdfx/hilog_lite/interfaces/native/innerkits"
hilog_lite_deps_path =
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared"
}
utils_lite_include_path = "//commonlibrary/utils_lite/include"
if (defined(board_toolchain_type)) {
if (board_toolchain_type != "iccarm") {
ohos_lite_cflags = [

View File

@ -69,7 +69,6 @@ if (defined(ohos_lite)) {
"src/stats_event.c",
"src/trans_event.c",
]
defines += [ "SOFTBUS_STANDARD_SYSTEM" ]
defines += [ "__STDC_FORMAT_MACROS" ]
if (is_asan) {
defines += [ "ASAN_BUILD" ]

View File

@ -40,19 +40,19 @@ static const SoftBusLogLabel AUTH_LABELS[MODULE_DOMAIN_MAX_LEN] = {
{ AUTH_TEST, DOMAIN_ID_TEST, "AuthTest" },
};
#if defined(SOFTBUS_LITE_SYSTEM) || defined(SOFTBUS_SMALL_SYSTEM)
#define AUTH_LOGF(label, ...) SOFTBUS_LITE_LOGF_INNER(label, ##__VA_ARGS__)
#define AUTH_LOGE(label, ...) SOFTBUS_LITE_LOGE_INNER(label, ##__VA_ARGS__)
#define AUTH_LOGW(label, ...) SOFTBUS_LITE_LOGW_INNER(label, ##__VA_ARGS__)
#define AUTH_LOGI(label, ...) SOFTBUS_LITE_LOGI_INNER(label, ##__VA_ARGS__)
#define AUTH_LOGD(label, ...) SOFTBUS_LITE_LOGD_INNER(label, ##__VA_ARGS__)
#if defined(SOFTBUS_LITEOS_M)
#define AUTH_LOGF(label, fmt, ...) SOFTBUS_LOGF_INNER(label, fmt, ##__VA_ARGS__)
#define AUTH_LOGE(label, fmt, ...) SOFTBUS_LOGE_INNER(label, fmt, ##__VA_ARGS__)
#define AUTH_LOGW(label, fmt, ...) SOFTBUS_LOGW_INNER(label, fmt, ##__VA_ARGS__)
#define AUTH_LOGI(label, fmt, ...) SOFTBUS_LOGI_INNER(label, fmt, ##__VA_ARGS__)
#define AUTH_LOGD(label, fmt, ...) SOFTBUS_LOGD_INNER(label, fmt, ##__VA_ARGS__)
#else
#define AUTH_LOGF(label, ...) (void)SOFTBUS_LOG_INNER(LOG_FATAL, AUTH_LABELS[label], ##__VA_ARGS__)
#define AUTH_LOGE(label, ...) (void)SOFTBUS_LOG_INNER(LOG_ERROR, AUTH_LABELS[label], ##__VA_ARGS__)
#define AUTH_LOGW(label, ...) (void)SOFTBUS_LOG_INNER(LOG_WARN, AUTH_LABELS[label], ##__VA_ARGS__)
#define AUTH_LOGI(label, ...) (void)SOFTBUS_LOG_INNER(LOG_INFO, AUTH_LABELS[label], ##__VA_ARGS__)
#define AUTH_LOGD(label, ...) (void)SOFTBUS_LOG_INNER(LOG_DEBUG, AUTH_LABELS[label], ##__VA_ARGS__)
#endif // SOFTBUS_LITE_SYSTEM || SOFTBUS_SMALL_SYSTEM
#define AUTH_LOGF(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_FATAL, AUTH_LABELS[label], fmt, ##__VA_ARGS__)
#define AUTH_LOGE(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_ERROR, AUTH_LABELS[label], fmt, ##__VA_ARGS__)
#define AUTH_LOGW(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_WARN, AUTH_LABELS[label], fmt, ##__VA_ARGS__)
#define AUTH_LOGI(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_INFO, AUTH_LABELS[label], fmt, ##__VA_ARGS__)
#define AUTH_LOGD(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_DEBUG, AUTH_LABELS[label], fmt, ##__VA_ARGS__)
#endif // SOFTBUS_LITEOS_M
#define AUTH_CHECK_AND_RETURN_RET_LOGW(cond, ret, label, fmt, ...) \
CHECK_AND_RETURN_RET_LOG_INNER(cond, ret, AUTH_LOGW, label, fmt, ##__VA_ARGS__)

View File

@ -48,19 +48,19 @@ static const SoftBusLogLabel COMM_LABELS[MODULE_DOMAIN_MAX_LEN] = {
{ COMM_TEST, DOMAIN_ID_TEST, "CommTest" },
};
#if defined(SOFTBUS_LITE_SYSTEM) || defined(SOFTBUS_SMALL_SYSTEM)
#define COMM_LOGF(label, ...) SOFTBUS_LITE_LOGF_INNER(label, ##__VA_ARGS__)
#define COMM_LOGE(label, ...) SOFTBUS_LITE_LOGE_INNER(label, ##__VA_ARGS__)
#define COMM_LOGW(label, ...) SOFTBUS_LITE_LOGW_INNER(label, ##__VA_ARGS__)
#define COMM_LOGI(label, ...) SOFTBUS_LITE_LOGI_INNER(label, ##__VA_ARGS__)
#define COMM_LOGD(label, ...) SOFTBUS_LITE_LOGD_INNER(label, ##__VA_ARGS__)
#if defined(SOFTBUS_LITEOS_M)
#define COMM_LOGF(label, fmt, ...) SOFTBUS_LOGF_INNER(label, fmt, ##__VA_ARGS__)
#define COMM_LOGE(label, fmt, ...) SOFTBUS_LOGE_INNER(label, fmt, ##__VA_ARGS__)
#define COMM_LOGW(label, fmt, ...) SOFTBUS_LOGW_INNER(label, fmt, ##__VA_ARGS__)
#define COMM_LOGI(label, fmt, ...) SOFTBUS_LOGI_INNER(label, fmt, ##__VA_ARGS__)
#define COMM_LOGD(label, fmt, ...) SOFTBUS_LOGD_INNER(label, fmt, ##__VA_ARGS__)
#else
#define COMM_LOGF(label, ...) (void)SOFTBUS_LOG_INNER(LOG_FATAL, COMM_LABELS[label], ##__VA_ARGS__)
#define COMM_LOGE(label, ...) (void)SOFTBUS_LOG_INNER(LOG_ERROR, COMM_LABELS[label], ##__VA_ARGS__)
#define COMM_LOGW(label, ...) (void)SOFTBUS_LOG_INNER(LOG_WARN, COMM_LABELS[label], ##__VA_ARGS__)
#define COMM_LOGI(label, ...) (void)SOFTBUS_LOG_INNER(LOG_INFO, COMM_LABELS[label], ##__VA_ARGS__)
#define COMM_LOGD(label, ...) (void)SOFTBUS_LOG_INNER(LOG_DEBUG, COMM_LABELS[label], ##__VA_ARGS__)
#endif // SOFTBUS_LITE_SYSTEM || SOFTBUS_SMALL_SYSTEM
#define COMM_LOGF(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_FATAL, COMM_LABELS[label], fmt, ##__VA_ARGS__)
#define COMM_LOGE(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_ERROR, COMM_LABELS[label], fmt, ##__VA_ARGS__)
#define COMM_LOGW(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_WARN, COMM_LABELS[label], fmt, ##__VA_ARGS__)
#define COMM_LOGI(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_INFO, COMM_LABELS[label], fmt, ##__VA_ARGS__)
#define COMM_LOGD(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_DEBUG, COMM_LABELS[label], fmt, ##__VA_ARGS__)
#endif // SOFTBUS_LITEOS_M
#define COMM_CHECK_AND_RETURN_RET_LOGW(cond, ret, label, fmt, ...) \
CHECK_AND_RETURN_RET_LOG_INNER(cond, ret, COMM_LOGW, label, fmt, ##__VA_ARGS__)

View File

@ -48,19 +48,19 @@ static const SoftBusLogLabel CONN_LABELS[MODULE_DOMAIN_MAX_LEN] = {
{CONN_TEST, DOMAIN_ID_TEST, "ConnTest"},
};
#if defined(SOFTBUS_LITE_SYSTEM) || defined(SOFTBUS_SMALL_SYSTEM)
#define CONN_LOGF(label, ...) SOFTBUS_LITE_LOGF_INNER(label, ##__VA_ARGS__)
#define CONN_LOGE(label, ...) SOFTBUS_LITE_LOGE_INNER(label, ##__VA_ARGS__)
#define CONN_LOGW(label, ...) SOFTBUS_LITE_LOGW_INNER(label, ##__VA_ARGS__)
#define CONN_LOGI(label, ...) SOFTBUS_LITE_LOGI_INNER(label, ##__VA_ARGS__)
#define CONN_LOGD(label, ...) SOFTBUS_LITE_LOGD_INNER(label, ##__VA_ARGS__)
#if defined(SOFTBUS_LITEOS_M)
#define CONN_LOGF(label, fmt, ...) SOFTBUS_LOGF_INNER(label, fmt, ##__VA_ARGS__)
#define CONN_LOGE(label, fmt, ...) SOFTBUS_LOGE_INNER(label, fmt, ##__VA_ARGS__)
#define CONN_LOGW(label, fmt, ...) SOFTBUS_LOGW_INNER(label, fmt, ##__VA_ARGS__)
#define CONN_LOGI(label, fmt, ...) SOFTBUS_LOGI_INNER(label, fmt, ##__VA_ARGS__)
#define CONN_LOGD(label, fmt, ...) SOFTBUS_LOGD_INNER(label, fmt, ##__VA_ARGS__)
#else
#define CONN_LOGF(label, ...) (void)SOFTBUS_LOG_INNER(LOG_FATAL, CONN_LABELS[label], ##__VA_ARGS__)
#define CONN_LOGE(label, ...) (void)SOFTBUS_LOG_INNER(LOG_ERROR, CONN_LABELS[label], ##__VA_ARGS__)
#define CONN_LOGW(label, ...) (void)SOFTBUS_LOG_INNER(LOG_WARN, CONN_LABELS[label], ##__VA_ARGS__)
#define CONN_LOGI(label, ...) (void)SOFTBUS_LOG_INNER(LOG_INFO, CONN_LABELS[label], ##__VA_ARGS__)
#define CONN_LOGD(label, ...) (void)SOFTBUS_LOG_INNER(LOG_DEBUG, CONN_LABELS[label], ##__VA_ARGS__)
#endif // SOFTBUS_LITE_SYSTEM || SOFTBUS_SMALL_SYSTEM
#define CONN_LOGF(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_FATAL, CONN_LABELS[label], fmt, ##__VA_ARGS__)
#define CONN_LOGE(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_ERROR, CONN_LABELS[label], fmt, ##__VA_ARGS__)
#define CONN_LOGW(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_WARN, CONN_LABELS[label], fmt, ##__VA_ARGS__)
#define CONN_LOGI(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_INFO, CONN_LABELS[label], fmt, ##__VA_ARGS__)
#define CONN_LOGD(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_DEBUG, CONN_LABELS[label], fmt, ##__VA_ARGS__)
#endif // SOFTBUS_LITEOS_M
#define CONN_CHECK_AND_RETURN_RET_LOGW(cond, ret, label, fmt, ...) \
CHECK_AND_RETURN_RET_LOG_INNER(cond, ret, CONN_LOGW, label, fmt, ##__VA_ARGS__)

View File

@ -52,19 +52,19 @@ static const SoftBusLogLabel DISC_LABELS[MODULE_DOMAIN_MAX_LEN] = {
{ DISC_TEST, DOMAIN_ID_TEST, "DiscTest" },
};
#if defined(SOFTBUS_LITE_SYSTEM) || defined(SOFTBUS_SMALL_SYSTEM)
#define DISC_LOGF(label, ...) SOFTBUS_LITE_LOGF_INNER(label, ##__VA_ARGS__)
#define DISC_LOGE(label, ...) SOFTBUS_LITE_LOGE_INNER(label, ##__VA_ARGS__)
#define DISC_LOGW(label, ...) SOFTBUS_LITE_LOGW_INNER(label, ##__VA_ARGS__)
#define DISC_LOGI(label, ...) SOFTBUS_LITE_LOGI_INNER(label, ##__VA_ARGS__)
#define DISC_LOGD(label, ...) SOFTBUS_LITE_LOGD_INNER(label, ##__VA_ARGS__)
#if defined(SOFTBUS_LITEOS_M)
#define DISC_LOGF(label, fmt, ...) SOFTBUS_LOGF_INNER(label, fmt, ##__VA_ARGS__)
#define DISC_LOGE(label, fmt, ...) SOFTBUS_LOGE_INNER(label, fmt, ##__VA_ARGS__)
#define DISC_LOGW(label, fmt, ...) SOFTBUS_LOGW_INNER(label, fmt, ##__VA_ARGS__)
#define DISC_LOGI(label, fmt, ...) SOFTBUS_LOGI_INNER(label, fmt, ##__VA_ARGS__)
#define DISC_LOGD(label, fmt, ...) SOFTBUS_LOGD_INNER(label, fmt, ##__VA_ARGS__)
#else
#define DISC_LOGF(label, ...) (void)SOFTBUS_LOG_INNER(LOG_FATAL, DISC_LABELS[label], ##__VA_ARGS__)
#define DISC_LOGE(label, ...) (void)SOFTBUS_LOG_INNER(LOG_ERROR, DISC_LABELS[label], ##__VA_ARGS__)
#define DISC_LOGW(label, ...) (void)SOFTBUS_LOG_INNER(LOG_WARN, DISC_LABELS[label], ##__VA_ARGS__)
#define DISC_LOGI(label, ...) (void)SOFTBUS_LOG_INNER(LOG_INFO, DISC_LABELS[label], ##__VA_ARGS__)
#define DISC_LOGD(label, ...) (void)SOFTBUS_LOG_INNER(LOG_DEBUG, DISC_LABELS[label], ##__VA_ARGS__)
#endif // SOFTBUS_LITE_SYSTEM || SOFTBUS_SMALL_SYSTEM
#define DISC_LOGF(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_FATAL, DISC_LABELS[label], fmt, ##__VA_ARGS__)
#define DISC_LOGE(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_ERROR, DISC_LABELS[label], fmt, ##__VA_ARGS__)
#define DISC_LOGW(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_WARN, DISC_LABELS[label], fmt, ##__VA_ARGS__)
#define DISC_LOGI(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_INFO, DISC_LABELS[label], fmt, ##__VA_ARGS__)
#define DISC_LOGD(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_DEBUG, DISC_LABELS[label], fmt, ##__VA_ARGS__)
#endif // SOFTBUS_LITEOS_M
#define DISC_CHECK_AND_RETURN_RET_LOGD(cond, ret, label, fmt, ...) \
CHECK_AND_RETURN_RET_LOG_INNER(cond, ret, DISC_LOGD, label, fmt, ##__VA_ARGS__)

View File

@ -50,19 +50,19 @@ static const SoftBusLogLabel LNN_LABELS[MODULE_DOMAIN_MAX_LEN] = {
{ LNN_TEST, DOMAIN_ID_TEST, "LnnTest" },
};
#if defined(SOFTBUS_LITE_SYSTEM) || defined(SOFTBUS_SMALL_SYSTEM)
#define LNN_LOGF(label, ...) SOFTBUS_LITE_LOGF_INNER(label, ##__VA_ARGS__)
#define LNN_LOGE(label, ...) SOFTBUS_LITE_LOGE_INNER(label, ##__VA_ARGS__)
#define LNN_LOGW(label, ...) SOFTBUS_LITE_LOGW_INNER(label, ##__VA_ARGS__)
#define LNN_LOGI(label, ...) SOFTBUS_LITE_LOGI_INNER(label, ##__VA_ARGS__)
#define LNN_LOGD(label, ...) SOFTBUS_LITE_LOGD_INNER(label, ##__VA_ARGS__)
#if defined(SOFTBUS_LITEOS_M)
#define LNN_LOGF(label, fmt, ...) SOFTBUS_LOGF_INNER(label, fmt, ##__VA_ARGS__)
#define LNN_LOGE(label, fmt, ...) SOFTBUS_LOGE_INNER(label, fmt, ##__VA_ARGS__)
#define LNN_LOGW(label, fmt, ...) SOFTBUS_LOGW_INNER(label, fmt, ##__VA_ARGS__)
#define LNN_LOGI(label, fmt, ...) SOFTBUS_LOGI_INNER(label, fmt, ##__VA_ARGS__)
#define LNN_LOGD(label, fmt, ...) SOFTBUS_LOGD_INNER(label, fmt, ##__VA_ARGS__)
#else
#define LNN_LOGF(label, ...) (void)SOFTBUS_LOG_INNER(LOG_FATAL, LNN_LABELS[label], ##__VA_ARGS__)
#define LNN_LOGE(label, ...) (void)SOFTBUS_LOG_INNER(LOG_ERROR, LNN_LABELS[label], ##__VA_ARGS__)
#define LNN_LOGW(label, ...) (void)SOFTBUS_LOG_INNER(LOG_WARN, LNN_LABELS[label], ##__VA_ARGS__)
#define LNN_LOGI(label, ...) (void)SOFTBUS_LOG_INNER(LOG_INFO, LNN_LABELS[label], ##__VA_ARGS__)
#define LNN_LOGD(label, ...) (void)SOFTBUS_LOG_INNER(LOG_DEBUG, LNN_LABELS[label], ##__VA_ARGS__)
#endif // SOFTBUS_LITE_SYSTEM || SOFTBUS_SMALL_SYSTEM
#define LNN_LOGF(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_FATAL, LNN_LABELS[label], fmt, ##__VA_ARGS__)
#define LNN_LOGE(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_ERROR, LNN_LABELS[label], fmt, ##__VA_ARGS__)
#define LNN_LOGW(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_WARN, LNN_LABELS[label], fmt, ##__VA_ARGS__)
#define LNN_LOGI(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_INFO, LNN_LABELS[label], fmt, ##__VA_ARGS__)
#define LNN_LOGD(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_DEBUG, LNN_LABELS[label], fmt, ##__VA_ARGS__)
#endif // SOFTBUS_LITEOS_M
#define LNN_CHECK_AND_RETURN_RET_LOGW(cond, ret, label, fmt, ...) \
CHECK_AND_RETURN_RET_LOG_INNER(cond, ret, LNN_LOGW, label, fmt, ##__VA_ARGS__)

View File

@ -20,7 +20,11 @@
#include <stdint.h>
#include <stdio.h>
#if defined(SOFTBUS_LITEOS_M)
#include "hilog_lite/log.h"
#else
#include "hilog/log.h"
#endif
#ifdef __cplusplus
extern "C" {
@ -38,20 +42,30 @@ extern "C" {
#define NSTACKX_LOG_DOMAIN 0xd0057ff
#define DOMAIN_ID_TEST 0xd000f00
#define FILE_NAME (__builtin_strrchr("/" __FILE__, '/') + 1)
#define FORMAT(fmt, ...) "[%{public}s:%{public}d] %{public}s# " fmt, FILE_NAME, __LINE__, __FUNCTION__, ##__VA_ARGS__
#define FILE_NAME (__builtin_strrchr("/" __FILE__, '/') + 1)
#define FORMAT(fmt) "[%{public}s:%{public}d] %{public}s# " fmt
/* For inner use only */
#if defined(SOFTBUS_LITE_SYSTEM) || defined(SOFTBUS_SMALL_SYSTEM)
#define SOFTBUS_LITE_LOGF_INNER(label, ...) HILOG_FATAL(HILOG_MODULE_SOFTBUS, FORMAT(__VA_ARGS__))
#define SOFTBUS_LITE_LOGE_INNER(label, ...) HILOG_ERROR(HILOG_MODULE_SOFTBUS, FORMAT(__VA_ARGS__))
#define SOFTBUS_LITE_LOGW_INNER(label, ...) HILOG_WARN(HILOG_MODULE_SOFTBUS, FORMAT(__VA_ARGS__))
#define SOFTBUS_LITE_LOGI_INNER(label, ...) HILOG_INFO(HILOG_MODULE_SOFTBUS, FORMAT(__VA_ARGS__))
#define SOFTBUS_LITE_LOGD_INNER(label, ...) HILOG_DEBUG(HILOG_MODULE_SOFTBUS, FORMAT(__VA_ARGS__))
#if defined(SOFTBUS_LITEOS_M)
#define SOFTBUS_LOGF_INNER(label, fmt, ...) \
HILOG_FATAL(HILOG_MODULE_SOFTBUS, FORMAT(fmt), FILE_NAME, __LINE__, __FUNCTION__, ##__VA_ARGS__)
#define SOFTBUS_LOGE_INNER(label, fmt, ...) \
HILOG_ERROR(HILOG_MODULE_SOFTBUS, FORMAT(fmt), FILE_NAME, __LINE__, __FUNCTION__, ##__VA_ARGS__)
#define SOFTBUS_LOGW_INNER(label, fmt, ...) \
HILOG_WARN(HILOG_MODULE_SOFTBUS, FORMAT(fmt), FILE_NAME, __LINE__, __FUNCTION__, ##__VA_ARGS__)
#define SOFTBUS_LOGI_INNER(label, fmt, ...) \
HILOG_INFO(HILOG_MODULE_SOFTBUS, FORMAT(fmt), FILE_NAME, __LINE__, __FUNCTION__, ##__VA_ARGS__)
#define SOFTBUS_LOGD_INNER(label, fmt, ...) \
HILOG_DEBUG(HILOG_MODULE_SOFTBUS, FORMAT(fmt), FILE_NAME, __LINE__, __FUNCTION__, ##__VA_ARGS__)
#elif defined(SOFTBUS_LITEOS_A)
#define SOFTBUS_LOG_INNER(level, label, fmt, ...) \
(void)HiLogPrint( \
LOG_CORE, level, label.domain, label.tag, FORMAT(fmt), FILE_NAME, __LINE__, __FUNCTION__, ##__VA_ARGS__)
#else
#define SOFTBUS_LOG_INNER(level, label, ...) \
HILOG_IMPL(LOG_CORE, level, label.domain, label.tag, FORMAT(__VA_ARGS__))
#endif // SOFTBUS_LITE_SYSTEM || SOFTBUS_SMALL_SYSTEM
#define SOFTBUS_LOG_INNER(level, label, fmt, ...) \
(void)HILOG_IMPL( \
LOG_CORE, level, label.domain, label.tag, FORMAT(fmt), FILE_NAME, __LINE__, __FUNCTION__, ##__VA_ARGS__)
#endif
typedef struct {
int32_t label;

View File

@ -49,19 +49,19 @@ static const SoftBusLogLabel TRANS_LABELS[MODULE_DOMAIN_MAX_LEN] = {
{ TRANS_TEST, DOMAIN_ID_TEST, "TransTest" },
};
#if defined(SOFTBUS_LITE_SYSTEM) || defined(SOFTBUS_SMALL_SYSTEM)
#define TRANS_LOGF(label, ...) SOFTBUS_LITE_LOGF_INNER(label, ##__VA_ARGS__)
#define TRANS_LOGE(label, ...) SOFTBUS_LITE_LOGE_INNER(label, ##__VA_ARGS__)
#define TRANS_LOGW(label, ...) SOFTBUS_LITE_LOGW_INNER(label, ##__VA_ARGS__)
#define TRANS_LOGI(label, ...) SOFTBUS_LITE_LOGI_INNER(label, ##__VA_ARGS__)
#define TRANS_LOGD(label, ...) SOFTBUS_LITE_LOGD_INNER(label, ##__VA_ARGS__)
#if defined(SOFTBUS_LITEOS_M)
#define TRANS_LOGF(label, fmt, ...) SOFTBUS_LOGF_INNER(label, fmt, ##__VA_ARGS__)
#define TRANS_LOGE(label, fmt, ...) SOFTBUS_LOGE_INNER(label, fmt, ##__VA_ARGS__)
#define TRANS_LOGW(label, fmt, ...) SOFTBUS_LOGW_INNER(label, fmt, ##__VA_ARGS__)
#define TRANS_LOGI(label, fmt, ...) SOFTBUS_LOGI_INNER(label, fmt, ##__VA_ARGS__)
#define TRANS_LOGD(label, fmt, ...) SOFTBUS_LOGD_INNER(label, fmt, ##__VA_ARGS__)
#else
#define TRANS_LOGF(label, ...) (void)SOFTBUS_LOG_INNER(LOG_FATAL, TRANS_LABELS[label], ##__VA_ARGS__)
#define TRANS_LOGE(label, ...) (void)SOFTBUS_LOG_INNER(LOG_ERROR, TRANS_LABELS[label], ##__VA_ARGS__)
#define TRANS_LOGW(label, ...) (void)SOFTBUS_LOG_INNER(LOG_WARN, TRANS_LABELS[label], ##__VA_ARGS__)
#define TRANS_LOGI(label, ...) (void)SOFTBUS_LOG_INNER(LOG_INFO, TRANS_LABELS[label], ##__VA_ARGS__)
#define TRANS_LOGD(label, ...) (void)SOFTBUS_LOG_INNER(LOG_DEBUG, TRANS_LABELS[label], ##__VA_ARGS__)
#endif // SOFTBUS_LITE_SYSTEM || SOFTBUS_SMALL_SYSTEM
#define TRANS_LOGF(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_FATAL, TRANS_LABELS[label], fmt, ##__VA_ARGS__)
#define TRANS_LOGE(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_ERROR, TRANS_LABELS[label], fmt, ##__VA_ARGS__)
#define TRANS_LOGW(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_WARN, TRANS_LABELS[label], fmt, ##__VA_ARGS__)
#define TRANS_LOGI(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_INFO, TRANS_LABELS[label], fmt, ##__VA_ARGS__)
#define TRANS_LOGD(label, fmt, ...) SOFTBUS_LOG_INNER(LOG_DEBUG, TRANS_LABELS[label], fmt, ##__VA_ARGS__)
#endif // SOFTBUS_LITEOS_M
#define TRANS_CHECK_AND_RETURN_RET_LOGW(cond, ret, label, fmt, ...) \
CHECK_AND_RETURN_RET_LOG_INNER(cond, ret, TRANS_LOGW, label, fmt, ##__VA_ARGS__)

View File

@ -30,6 +30,7 @@ if (defined(ohos_lite)) {
"$dsoftbus_dfx_path/interface/include",
"$dsoftbus_root_path/interfaces/kits/common",
"$hilog_lite_include_path",
"$utils_lite_include_path",
]
cflags = ohos_lite_cflags
cflags_cc = ohos_lite_cflags

View File

@ -19,21 +19,21 @@
#define NSTACKX_LOG_LEVEL_CONVERT_BASE 8
static void SoftBusLogPrint(const char *line, LogLevel level, uint32_t domain, const char *tag)
static void SoftBusLogPrint(const char *line, uint32_t level, uint32_t domain, const char *tag)
{
#if defined(SOFTBUS_LITE_SYSTEM) || defined(SOFTBUS_SMALL_SYSTEM)
#if defined(SOFTBUS_LITEOS_M)
(void)level;
(void)domain;
(void)tag;
printf("%s\n", line);
#else
(void)HiLogPrint(LOG_CORE, level, domain, tag, "%{public}s", line);
(void)HiLogPrint(LOG_CORE, (LogLevel)level, domain, tag, "%{public}s", line);
#endif
}
void NstackxLogInnerImpl(const char *moduleName, uint32_t logLevel, const char *fmt, ...)
{
LogLevel level = NSTACKX_LOG_LEVEL_CONVERT_BASE - logLevel;
uint32_t level = NSTACKX_LOG_LEVEL_CONVERT_BASE - logLevel;
va_list args = { 0 };
char line[LOG_LINE_MAX_LENGTH + 1] = { 0 };
va_start(args, fmt);

View File

@ -76,7 +76,9 @@ extern "C" {
#define MAX_UDP_CHANNEL_ID_COUNT 20
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
#endif
typedef struct {
SoftBusMutex lock;

View File

@ -28,7 +28,7 @@
#define MAX_BYTES_LENGTH 4194304
#define MAX_MESSAGE_LENGTH 4096
#ifdef SOFTBUS_STANDARD_SYSTEM
#ifdef SOFTBUS_LINUX
#define CONN_BR_MAX_DATA_LENGTH (40 * 1000)
#define CONN_COC_MAX_DATA_LENGTH (40 * 1000)
#define CONN_BLE_CLOSE_DELAY (10 * 1000)
@ -62,7 +62,7 @@
#define DEFAULT_DISC_FREQ_HIGH ((5 << 16) | 36)
#define DEFAULT_DISC_FREQ_SUPER_HIGH ((10 << 16) | 48)
#ifdef SOFTBUS_STANDARD_SYSTEM
#ifdef SOFTBUS_LINUX
#define DEFAULT_NEW_BYTES_LEN (4 * 1024 * 1024)
#define DEFAULT_NEW_MESSAGE_LEN (4 * 1024)
#define DEFAULT_MAX_BYTES_LEN (4 * 1024 * 1024)
@ -73,7 +73,7 @@
#define DEFAULT_PROXY_MAX_MESSAGE_LEN (1 * 1024)
#define DEFAULT_IS_SUPPORT_TCP_PROXY 1
#define DEFAULT_BLE_MAC_AUTO_REFRESH 1
#elif defined SOFTBUS_SMALL_SYSTEM
#elif defined SOFTBUS_LITEOS_A
#define DEFAULT_NEW_BYTES_LEN (1 * 1024 * 1024)
#define DEFAULT_NEW_MESSAGE_LEN (4 * 1024)
#define DEFAULT_MAX_BYTES_LEN (1 * 1024 * 1024)

View File

@ -56,10 +56,10 @@ if (defined(global_parts_info) &&
if (defined(ohos_lite)) {
import("//build/lite/config/component/lite_component.gni")
if (ohos_kernel_type == "liteos_m") {
defines = [ "SOFTBUS_MINI_SYSTEM" ]
defines = [ "SOFTBUS_LITEOS_M" ]
import("$softbus_adapter_config/feature_config/mini/config.gni")
} else {
defines = [ "SOFTBUS_SMALL_SYSTEM" ]
defines = [ "SOFTBUS_LITEOS_A" ]
import("$softbus_adapter_config/feature_config/small/config.gni")
}
} else {
@ -68,7 +68,7 @@ if (defined(ohos_lite)) {
} else {
os_type = "standard"
}
defines = [ "SOFTBUS_STANDARD_SYSTEM" ]
defines = [ "SOFTBUS_LINUX" ]
import("//build/ohos.gni")
import(
"$dsoftbus_feature_product_config_path/feature_config/standard/config.gni")

View File

@ -24,5 +24,6 @@ static_library("softbus_test_message_handler") {
"$dsoftbus_root_path/core/common/include",
"$softbus_adapter_common/include",
"$hilog_lite_include_path",
"$utils_lite_include_path",
]
}