hilog轻量化

Signed-off-by: fangting <fangting12@huawei.com>
This commit is contained in:
fangting 2024-03-27 11:36:17 +08:00
parent 83a63c667c
commit 157d626264
4 changed files with 26 additions and 15 deletions

View File

@ -19,8 +19,17 @@
#include "common/macros.h"
#if defined(ENABLE_HILOG)
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
#elif defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
#endif
#include "hilog/log.h"
#endif
#undef LOG_DOMAIN
#define LOG_DOMAIN 0xD003F00
#undef LOG_TAG
#define LOG_TAG "ArkCompiler"
namespace OHOS::ArkCompiler::Toolchain {
#ifdef LOGF
@ -57,12 +66,6 @@ public:
static void PrintLog(LogLevel level, const char* fmt, ...);
};
#else
static constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {
LOG_CORE,
0xD003F00,
"ArkCompiler"
};
#endif
#pragma clang diagnostic push
@ -74,11 +77,11 @@ static constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {
#define LOGI(fmt, ...) StdLog::PrintLog(LogLevel::INFO, fmt, ##__VA_ARGS__)
#define LOGD(fmt, ...) StdLog::PrintLog(LogLevel::DEBUG, fmt, ##__VA_ARGS__)
#else
#define LOGF(fmt, ...) OHOS::HiviewDFX::HiLog::Fatal(LABEL, fmt, ##__VA_ARGS__)
#define LOGE(fmt, ...) OHOS::HiviewDFX::HiLog::Error(LABEL, fmt, ##__VA_ARGS__)
#define LOGW(fmt, ...) OHOS::HiviewDFX::HiLog::Warn(LABEL, fmt, ##__VA_ARGS__)
#define LOGI(fmt, ...) OHOS::HiviewDFX::HiLog::Info(LABEL, fmt, ##__VA_ARGS__)
#define LOGD(fmt, ...) OHOS::HiviewDFX::HiLog::Debug(LABEL, fmt, ##__VA_ARGS__)
#define LOGF(fmt, ...) HILOG_FATAL(LOG_CORE, fmt, ##__VA_ARGS__)
#define LOGE(fmt, ...) HILOG_ERROR(LOG_CORE, fmt, ##__VA_ARGS__)
#define LOGW(fmt, ...) HILOG_WARN(LOG_CORE, fmt, ##__VA_ARGS__)
#define LOGI(fmt, ...) HILOG_INFO(LOG_CORE, fmt, ##__VA_ARGS__)
#define LOGD(fmt, ...) HILOG_DEBUG(LOG_CORE, fmt, ##__VA_ARGS__)
#endif
#pragma clang diagnostic pop
} // namespace OHOS::ArkCompiler::Toolchain

View File

@ -59,7 +59,9 @@ ohos_shared_library("ark_debugger") {
"-lws2_32",
]
}
if (enable_hilog) {
external_deps = [ "hilog:libhilog" ]
}
innerapi_tags = [ "platformsdk" ]
subsystem_name = "arkcompiler"
part_name = "toolchain"
@ -107,7 +109,9 @@ ohos_source_set("connectserver_debugger_static") {
ohos_shared_library("connectserver_debugger") {
deps = [ ":connectserver_debugger_static" ]
if (enable_hilog) {
external_deps = [ "hilog:libhilog" ]
}
innerapi_tags = [ "platformsdk" ]
subsystem_name = "arkcompiler"
part_name = "toolchain"

View File

@ -72,7 +72,9 @@ ohos_shared_library("libark_client") {
if (!is_mingw && !is_mac) {
output_extension = "so"
}
if (enable_hilog) {
external_deps = [ "hilog:libhilog" ]
}
subsystem_name = "arkcompiler"
part_name = "toolchain"
}

View File

@ -91,7 +91,9 @@ ohos_shared_library("debugger_entry") {
foreach(file, test_js_files) {
deps += [ ":gen_${file}_abc" ]
}
if (enable_hilog) {
external_deps = [ "hilog:libhilog" ]
}
install_enable = false
output_extension = "so"
subsystem_name = "test"