napi log to HILOG_IMPL

Signed-off-by: lushi1202 <lushi@huawei.com>
Change-Id: Ida29e0a08742fadc9b2cd43ab9b42b71e86eed67
This commit is contained in:
lushi1202 2024-03-19 21:11:53 +08:00
parent cdb9cc8bbd
commit 1a4a79b441
31 changed files with 66 additions and 194 deletions

View File

@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Copyright (c) 2021-2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@ -23,7 +23,7 @@ config("ace_config") {
"//third_party/zlib",
]
if (is_mingw || is_mac || is_linux || is_ohos) {
if (use_hilog) {
include_dirs += [ "$hilog_root/interfaces/native/innerkits/include" ]
}

View File

@ -1,4 +1,4 @@
# Copyright (c) 2021-2023 Huawei Device Co., Ltd.
# Copyright (c) 2021-2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@ -63,11 +63,14 @@ use_ios = "${current_os}_${current_cpu}" == "ios_x64" ||
"${current_os}_${current_cpu}" == "ios_arm64"
use_linux = "${current_os}_${current_cpu}" == "linux_x64"
use_hilog = is_mingw || is_mac || is_linux || is_ohos || is_ohos_standard_system
# Config path
ace_root = "//foundation/arkui/ace_engine"
hilog_root = "//base/hiviewdfx/hilog"
ace_napi_frameworks = "//foundation/arkui/ace_engine/frameworks"
ace_napi = "//foundation/arkui/napi"
arkui_root = "//foundation/arkui"
ace_graphic = "//foundation/graphic/graphic_2d"
ace_hitrace = "//base/hiviewdfx/hitrace"
c_utils_root = "//commonlibrary/c_utils"
@ -151,6 +154,10 @@ ace_ivi_defines = [ "IVI_PRODUCT" ]
ace_common_defines = [ "ACE_LOG_TAG=\"Ace\"" ]
if (use_hilog) {
ace_common_defines += [ "USE_HILOG" ]
}
if (enable_glfw_window) {
ace_common_defines += [ "USE_GLFW_WINDOW" ]
}

View File

@ -93,6 +93,7 @@ template("js_pa_engine_ark") {
sources = [
"$ace_root/adapter/ohos/entrance/pa_engine/engine/common/js_backend_asset_manager.cpp",
"$ace_root/adapter/ohos/entrance/pa_engine/engine/common/js_backend_timer_module.cpp",
"$ace_root/adapter/ohos/osal/log_wrapper.cpp",
"$ace_root/frameworks/bridge/js_frontend/engine/jsi/ark_js_runtime.cpp",
"$ace_root/frameworks/bridge/js_frontend/engine/jsi/ark_js_value.cpp",
"$ace_root/frameworks/bridge/js_frontend/engine/jsi/jsi_base_utils.cpp",

View File

@ -95,7 +95,7 @@ config("reduce_eh_frame_config") {
}
ohos_shared_library("libace_compatible") {
if (is_mingw || is_mac || is_linux || is_ohos) {
if (use_hilog) {
external_deps = [ "hilog:libhilog" ]
}
if (is_ohos) {
@ -122,7 +122,7 @@ ohos_shared_library("libace_compatible") {
if (!is_asan) {
ohos_shared_library("libace") {
if (is_mingw || is_mac || is_linux || is_ohos) {
if (use_hilog) {
external_deps = [ "hilog:libhilog" ]
}
if (is_ohos) {

View File

@ -109,7 +109,7 @@ template("ace_bridge_engine") {
assert(defined(platform) && (platform == "ohos" || platform == "ohos_ng"),
"Only ohos need separated engine lib")
if (is_mingw || is_mac || is_linux || is_ohos) {
if (use_hilog) {
external_deps = [ "hilog:libhilog" ]
}
if (build_type == "engine") {

View File

@ -33,7 +33,7 @@
#define ACE_LOG_ID_WITH_REASON
#endif
#if defined(OHOS_PLATFORM) || defined(PREVIEW)
#if defined(USE_HILOG)
#include "hilog/log.h"
constexpr uint32_t ACE_DOMAIN = 0xD003900;
constexpr uint32_t APP_DOMAIN = 0xC0D0;

View File

@ -1,4 +1,4 @@
# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
# Copyright (c) 2021-2024 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

View File

@ -60,7 +60,7 @@ static constexpr OHOS::HiviewDFX::HiLogLabel LOG_LABEL = {LOG_CORE, FR_LOG_DOMAI
FR_FILENAME, __FUNCTION__, __LINE__, ##__VA_ARGS__)
#define HILOG_FATAL(fmt, ...) PRINT_HILOG(FATAL, fmt, ##__VA_ARGS__)
#define HILOG_ERROR(fmt, ...) PRINT_HILOG(ERROR, fmt,##__VA_ARGS__)
#define HILOG_ERROR(fmt, ...) PRINT_HILOG(ERROR, fmt, ##__VA_ARGS__)
#define HILOG_WARN(fmt, ...) PRINT_HILOG(WARN, fmt, ##__VA_ARGS__)
#define HILOG_INFO(fmt, ...) PRINT_HILOG(INFO, fmt, ##__VA_ARGS__)
#define HILOG_DEBUG(fmt, ...) PRINT_HILOG(DEBUG, fmt, ##__VA_ARGS__)

View File

@ -15,6 +15,25 @@ import("//build/ohos.gni")
import("//foundation/arkui/ace_engine/ace_config.gni")
import("napi_lib.gni")
config("ace_napi_config") {
include_dirs = [
"$ace_root",
"$arkui_root",
"$ace_root/frameworks",
"$root_out_dir/arkui",
"$root_out_dir/arkui/framework",
"//third_party/zlib",
]
if (use_hilog) {
include_dirs += [ "$hilog_root/interfaces/native/innerkits/include" ]
}
if (is_mac) {
cflags_cc = [ "-O0" ]
}
}
common_targets = []
foreach(module, common_napi_libs) {
if (use_mac) {

View File

@ -20,15 +20,7 @@ template("napi_animator_static") {
ohos_source_set(target_name) {
defines += invoker.defines
cflags_cc += invoker.cflags_cc
if (is_mac) {
cflags_cc += [ "-O0" ]
}
include_dirs = [
"//foundation/arkui",
"$ace_root",
"$ace_root/frameworks",
]
configs = [ "$ace_root/interfaces/napi/kits:ace_napi_config" ]
sources = [ "js_animator.cpp" ]

View File

@ -20,15 +20,7 @@ template("napi_atomic_service_bar_static") {
ohos_source_set(target_name) {
defines += invoker.defines
cflags_cc += invoker.cflags_cc
if (is_mac) {
cflags_cc += [ "-O0" ]
}
include_dirs = [
"$ace_root",
"$ace_root/frameworks",
"$root_out_dir/arkui/framework",
]
configs = [ "$ace_root/interfaces/napi/kits:ace_napi_config" ]
sources = [ "js_atomic_service_bar.cpp" ]

View File

@ -20,15 +20,7 @@ template("napi_componentsnapshot_static") {
ohos_source_set(target_name) {
defines += invoker.defines
cflags_cc += invoker.cflags_cc
if (is_mac) {
cflags_cc += [ "-O0" ]
}
include_dirs = [
"$ace_root",
"$ace_root/frameworks",
"$root_out_dir/arkui/framework",
]
configs = [ "$ace_root/interfaces/napi/kits:ace_napi_config" ]
sources = [ "js_component_snapshot.cpp" ]

View File

@ -14,23 +14,14 @@
import("//build/ohos.gni")
import("//foundation/arkui/ace_engine/ace_config.gni")
configs = [ "$ace_root:ace_config" ]
template("napi_componentutils_static") {
forward_variables_from(invoker, "*")
ohos_source_set(target_name) {
defines += invoker.defines
cflags_cc += invoker.cflags_cc
if (is_mac) {
cflags_cc += [ "-O0" ]
}
include_dirs = [
"$ace_root",
"$ace_root/frameworks",
"$root_out_dir/arkui/framework",
]
configs = [ "$ace_root:ace_config" ]
sources = [ "js_component_utils.cpp" ]
if (platform != "ohos" || is_asan) {

View File

@ -21,11 +21,7 @@ template("napi_configuration_static") {
defines += invoker.defines
cflags_cc += invoker.cflags_cc
include_dirs = [
"//commonlibrary/c_utils/base/include",
"$ace_root",
"$ace_root/frameworks",
]
configs = [ "$ace_root/interfaces/napi/kits:ace_napi_config" ]
sources = [ "js_configuration.cpp" ]

View File

@ -20,16 +20,7 @@ template("napi_device_static") {
ohos_source_set(target_name) {
defines += invoker.defines
cflags_cc += invoker.cflags_cc
if (is_mac) {
cflags_cc += [ "-O0" ]
}
include_dirs = [
"//commonlibrary/c_utils/base/include",
"//foundation/arkui",
"$ace_root",
"$ace_root/frameworks",
]
configs = [ "$ace_root/interfaces/napi/kits:ace_napi_config" ]
sources = [ "js_device.cpp" ]

View File

@ -20,15 +20,7 @@ template("napi_display_sync_static") {
ohos_source_set(target_name) {
defines += invoker.defines
cflags_cc += invoker.cflags_cc
if (is_mac) {
cflags_cc += [ "-O0" ]
}
include_dirs = [
"$ace_root",
"$ace_root/frameworks",
"$root_out_dir/arkui/framework",
]
configs = [ "$ace_root/interfaces/napi/kits:ace_napi_config" ]
sources = [ "js_display_sync.cpp" ]

View File

@ -19,17 +19,11 @@ template("napi_dragcontroller_static") {
ohos_source_set(target_name) {
defines += invoker.defines
defines += [ "USE_ARK_ENGINE" ]
cflags_cc += invoker.cflags_cc
if (is_mac) {
cflags_cc += [ "-O0" ]
}
configs = [ "$ace_root/interfaces/napi/kits:ace_napi_config" ]
include_dirs = [
"$ace_root",
"$ace_root/frameworks",
"$root_out_dir/arkui/framework",
"$ark_ets_path",
"$ark_runtime_path",
]

View File

@ -20,16 +20,7 @@ template("napi_font_static") {
ohos_source_set(target_name) {
defines += invoker.defines
cflags_cc += invoker.cflags_cc
if (is_mac) {
cflags_cc += [ "-O0" ]
}
include_dirs = [
"//foundation/arkui",
"$ace_root",
"$ace_root/frameworks",
"$root_out_dir/arkui/framework",
]
configs = [ "$ace_root/interfaces/napi/kits:ace_napi_config" ]
sources = [ "js_font.cpp" ]

View File

@ -20,15 +20,7 @@ template("napi_grid_static") {
ohos_source_set(target_name) {
defines += invoker.defines
cflags_cc += invoker.cflags_cc
if (is_mac) {
cflags_cc += [ "-O0" ]
}
include_dirs = [
"//foundation/arkui",
"$ace_root",
"$ace_root/frameworks",
]
configs = [ "$ace_root/interfaces/napi/kits:ace_napi_config" ]
sources = [ "js_grid.cpp" ]

View File

@ -20,15 +20,8 @@ template("napi_inspector_static") {
ohos_source_set(target_name) {
defines += invoker.defines
cflags_cc += invoker.cflags_cc
if (is_mac) {
cflags_cc += [ "-O0" ]
}
include_dirs = [
"$ace_root",
"$ace_root/frameworks",
"$root_out_dir/arkui/framework",
]
configs = [ "$ace_root/interfaces/napi/kits:ace_napi_config" ]
sources = [ "js_inspector.cpp" ]

View File

@ -20,16 +20,7 @@ template("napi_measure_static") {
ohos_source_set(target_name) {
defines += invoker.defines
cflags_cc += invoker.cflags_cc
if (is_mac) {
cflags_cc += [ "-O0" ]
}
include_dirs = [
"//foundation/arkui",
"$ace_root",
"$ace_root/frameworks",
"$root_out_dir/arkui/framework",
]
configs = [ "$ace_root/interfaces/napi/kits:ace_napi_config" ]
sources = [ "js_measure.cpp" ]

View File

@ -20,16 +20,8 @@ template("napi_mediaquery_static") {
ohos_source_set(target_name) {
defines += invoker.defines
cflags_cc += invoker.cflags_cc
if (is_mac) {
cflags_cc += [ "-O0" ]
}
include_dirs = [
"//foundation/arkui",
"$ace_root",
"$ace_root/frameworks",
"$root_out_dir/arkui/framework",
]
configs = [ "$ace_root/interfaces/napi/kits:ace_napi_config" ]
sources = [ "js_media_query.cpp" ]

View File

@ -64,14 +64,20 @@ template("ace_napi_lib") {
}
}
deps = [ "$ace_root/interfaces/napi/kits/${module_path}:${module_name}_static_${platform}" ]
cflags = []
ldflags = []
sources = []
defines = []
include_dirs = []
if (ace_engine_feature_enable_coverage) {
cflags += [ "--coverage" ]
ldflags += [ "--coverage" ]
}
if (use_hilog) {
include_dirs += [ "$ace_root/frameworks" ]
sources += [ "$ace_root/adapter/ohos/osal/log_wrapper.cpp" ]
external_deps = [ "hilog:libhilog" ]
}
relative_install_dir = "module" + install_dir
part_name = ace_engine_part
subsystem_name = ace_engine_subsystem

View File

@ -20,15 +20,7 @@ template("napi_observer_static") {
ohos_source_set(target_name) {
defines += invoker.defines
cflags_cc += invoker.cflags_cc
if (is_mac) {
cflags_cc += [ "-O0" ]
}
include_dirs = [
"$ace_root",
"$ace_root/frameworks",
"$root_out_dir/arkui/framework",
]
configs = [ "$ace_root/interfaces/napi/kits:ace_napi_config" ]
sources = [
"js_ui_observer.cpp",

View File

@ -29,11 +29,13 @@ ohos_shared_library("plugincomponent") {
"js_plugin_callback.cpp",
"js_plugin_callback_mgr.cpp",
"js_plugin_component.cpp",
"js_plugin_log_wrapper.cpp",
"js_plugin_util.cpp",
"js_plugin_want.cpp",
]
defines = [ "OHOS_PLATFORM" ]
sources += [ "$ace_root/adapter/ohos/osal/log_wrapper.cpp" ]
deps = [ "$ace_root/build:libace_compatible" ]
external_deps = [

View File

@ -1,22 +0,0 @@
/*
* Copyright (c) 2021-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "base/log/log_wrapper.h"
namespace OHOS::Ace {
const std::unordered_map<AceLogTag, const char*> g_DOMAIN_CONTENTS_MAP = {
{ AceLogTag::ACE_PLUGIN_COMPONENT, "AcePluginComponent" },
};
} // namespace OHOS::Ace

View File

@ -20,16 +20,7 @@ template("napi_prompt_static") {
ohos_source_set(target_name) {
defines += invoker.defines
cflags_cc += invoker.cflags_cc
if (is_mac) {
cflags_cc += [ "-O0" ]
}
include_dirs = [
"//foundation/arkui",
"$ace_root",
"$ace_root/frameworks",
"$root_out_dir/arkui/framework",
]
configs = [ "$ace_root/interfaces/napi/kits:ace_napi_config" ]
sources = [
"../promptaction/js_prompt_action.cpp",

View File

@ -20,16 +20,8 @@ template("napi_promptaction_static") {
ohos_source_set(target_name) {
defines += invoker.defines
cflags_cc += invoker.cflags_cc
if (is_mac) {
cflags_cc += [ "-O0" ]
}
include_dirs = [
"//foundation/arkui",
"$ace_root",
"$ace_root/frameworks",
"$root_out_dir/arkui/framework",
]
configs = [ "$ace_root/interfaces/napi/kits:ace_napi_config" ]
sources = [
"../promptaction/prompt_action.cpp",

View File

@ -20,16 +20,8 @@ template("napi_router_static") {
ohos_source_set(target_name) {
defines += invoker.defines
cflags_cc += invoker.cflags_cc
if (is_mac) {
cflags_cc += [ "-O0" ]
}
include_dirs = [
"//foundation/arkui",
"$ace_root",
"$ace_root/frameworks",
"$root_out_dir/arkui/framework",
]
configs = [ "$ace_root/interfaces/napi/kits:ace_napi_config" ]
sources = [ "js_router.cpp" ]

View File

@ -20,16 +20,8 @@ template("napi_utils_static") {
ohos_source_set(target_name) {
defines += invoker.defines
cflags_cc += invoker.cflags_cc
if (is_mac) {
cflags_cc += [ "-O0" ]
}
include_dirs = [
"//foundation/arkui",
"$ace_root",
"$ace_root/frameworks",
"$root_out_dir/arkui/framework",
]
configs = [ "$ace_root/interfaces/napi/kits:ace_napi_config" ]
sources = [ "napi_utils.cpp" ]

View File

@ -63,6 +63,7 @@ ohos_shared_library("ace_ndk") {
cflags_cc = [ "-Wno-missing-braces" ]
if (target_os == "ohos") {
defines = [ "OHOS_PLATFORM" ]
sources += [ "$ace_root/adapter/ohos/osal/log_wrapper.cpp" ]
deps += [ ":libace_ndk" ]
external_deps = [