diff --git a/bundle.json b/bundle.json index 2ea2ffc01f77c8a82735bc26fb5ff05575e0c721..16b9262b1f724b44a827cd51d2d3b245b39a2598 100644 --- a/bundle.json +++ b/bundle.json @@ -21,7 +21,26 @@ "mini", "small" ], - "features": ["hilog_lite_customize_implementation"], + "features": [ + "hilog_lite_disable_privacy_feature", + "hilog_lite_disable_hilog_static", + "hilog_lite_file_size", + "hilog_lite_disable_cache", + "hilog_lite_limit_level_default", + "hilog_lite_disable_print_limit", + "hilog_lite_log_static_cache_size", + "hilog_lite_hiview_hilog_file_buf_size", + "hilog_lite_disable_core_init", + "hilog_lite_customize_implementation", + "hilog_lite_hilog_file_size", + "hilog_lite_enable_apphilogcat_init_release", + "hilog_lite_enable_apphilogcat_init_debug", + "hilog_lite_apphilogcat_log_level_release", + "hilog_lite_apphilogcat_log_level_debug", + "hilog_lite_enable_hilogcat_build", + "hilog_lite_apphilogcat_log_dir", + "hilog_lite_disable_test" + ], "rom": "500KB", "ram": "~500KB", "deps": { diff --git a/frameworks/featured/BUILD.gn b/frameworks/featured/BUILD.gn index dbe69429a9f055563296d9c468f559f138d1c491..f0d1c7b80edd069cfb5d149e7b7d097bafb44114 100644 --- a/frameworks/featured/BUILD.gn +++ b/frameworks/featured/BUILD.gn @@ -14,21 +14,17 @@ import("//build/lite/config/component/lite_component.gni") import("//build/lite/ndk/ndk.gni") declare_args() { - ohos_hiviewdfx_disable_privacy_feature = false + hilog_lite_disable_privacy_feature = false + hilog_lite_disable_hilog_static = false } -hilog_sources = [ - "hilog.cpp", - "hiview_log.c", -] - config("hilog_config") { include_dirs = [ "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits/hilog", "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits", "//third_party/bounds_checking_function/include", ] - if (ohos_hiviewdfx_disable_privacy_feature) { + if (hilog_lite_disable_privacy_feature) { defines = [ "DISABLE_HILOG_PRIVACY" ] } if (ohos_kernel_type != "liteos_m") { @@ -41,14 +37,27 @@ config("hilog_config") { } } -lite_library("hilog_static") { - target_type = "static_library" - sources = hilog_sources - public_configs = [ ":hilog_config" ] - public_deps = [ "//third_party/bounds_checking_function:libsec_static" ] +if (hilog_lite_disable_hilog_static) { + group("hilog_static") { + } +} else { + hilog_sources = [ + "hilog.cpp", + "hiview_log.c", + ] + lite_library("hilog_static") { + target_type = "static_library" + sources = hilog_sources + public_configs = [ ":hilog_config" ] + public_deps = [ "//third_party/bounds_checking_function:libsec_static" ] + } } if (ohos_kernel_type != "liteos_m") { + hilog_sources = [ + "hilog.cpp", + "hiview_log.c", + ] lite_library("hilog_shared") { target_type = "shared_library" sources = hilog_sources diff --git a/frameworks/mini/BUILD.gn b/frameworks/mini/BUILD.gn index 3b90d4340e32e4c3cdcfc883a6fef5845f51404a..7530e756273140cd9478bb7cfd0280b6507a0a2e 100644 --- a/frameworks/mini/BUILD.gn +++ b/frameworks/mini/BUILD.gn @@ -14,12 +14,13 @@ import("//build/lite/ndk/ndk.gni") declare_args() { - ohos_hiviewdfx_hilog_lite_file_size = 8192 - ohos_hiviewdfx_hilog_lite_disable_cache = false - ohos_hiviewdfx_hilog_lite_limit_level_default = 30 - ohos_hiviewdfx_hilog_lite_disable_print_limit = false - ohos_hiviewdfx_log_static_cache_size = 1024 - ohos_hiviewdfx_hiview_hilog_file_buf_size = 512 + hilog_lite_file_size = 8192 + hilog_lite_disable_cache = false + hilog_lite_limit_level_default = 30 + hilog_lite_disable_print_limit = false + hilog_lite_log_static_cache_size = 1024 + hilog_lite_hiview_hilog_file_buf_size = 512 + hilog_lite_disable_core_init = false hilog_lite_customize_implementation = false } @@ -39,17 +40,20 @@ static_library("hilog_lite_static") { "hiview_output_log.c", ] defines = [ - "HIVIEW_LOG_FILE_SIZE=$ohos_hiviewdfx_hilog_lite_file_size", - "LOG_LIMIT_DEFAULT=$ohos_hiviewdfx_hilog_lite_limit_level_default", - "LOG_STATIC_CACHE_SIZE=$ohos_hiviewdfx_log_static_cache_size", - "HIVIEW_HILOG_FILE_BUF_SIZE=$ohos_hiviewdfx_hiview_hilog_file_buf_size", + "HIVIEW_LOG_FILE_SIZE=$hilog_lite_file_size", + "LOG_LIMIT_DEFAULT=$hilog_lite_limit_level_default", + "LOG_STATIC_CACHE_SIZE=$hilog_lite_log_static_cache_size", + "HIVIEW_HILOG_FILE_BUF_SIZE=$hilog_lite_hiview_hilog_file_buf_size", ] - if (ohos_hiviewdfx_hilog_lite_disable_cache) { + if (hilog_lite_disable_cache) { defines += [ "DISABLE_HILOG_CACHE" ] } - if (ohos_hiviewdfx_hilog_lite_disable_print_limit) { + if (hilog_lite_disable_print_limit) { defines += [ "DISABLE_HILOG_LITE_PRINT_LIMIT" ] } + if (hilog_lite_disable_core_init) { + defines += [ "DISABLE_HILOG_LITE_CORE_INIT" ] + } public_configs = [ "//base/hiviewdfx/hiview_lite:hiview_lite_config", ":hilog_lite_config", diff --git a/frameworks/mini/hiview_log.c b/frameworks/mini/hiview_log.c index 356bef5b50f3f880bacdd781b6977cb936b0651e..7f08f830918452bb1741f7ced6bc9990ca2fafe9 100644 --- a/frameworks/mini/hiview_log.c +++ b/frameworks/mini/hiview_log.c @@ -33,7 +33,7 @@ const char * const FUN_ARG_S = "0123456I"; static boolean CheckParameters(uint8 module, uint8 level); /* The first step does not involve memory allocation. */ -static void HiLogInit(void) +void HiLogInit(void) { HIVIEW_UartPrint("hilog will init.\n"); InitCoreLogOutput(); @@ -62,7 +62,9 @@ static void HiLogInit(void) HiviewRegisterInitFunc(HIVIEW_CMP_TYPE_LOG_LIMIT, InitLogLimit); HILOG_DEBUG(HILOG_MODULE_HIVIEW, "hilog init success."); } +#ifndef DISABLE_HILOG_LITE_CORE_INIT CORE_INIT_PRI(HiLogInit, 0); +#endif static boolean CheckParameters(uint8 module, uint8 level) { diff --git a/frameworks/mini/hiview_output_log.h b/frameworks/mini/hiview_output_log.h index a114f36cbdc7594d04351edabacca59f1dd541e2..233aeedbbe1c48ead6175ad311d74ae8428d8cc0 100644 --- a/frameworks/mini/hiview_output_log.h +++ b/frameworks/mini/hiview_output_log.h @@ -25,6 +25,7 @@ extern "C" { #endif #endif /* End of #ifdef __cplusplus */ +void HiLogInit(void); void InitCoreLogOutput(void); void InitLogOutput(void); void ClearLogOutput(void); diff --git a/services/apphilogcat/BUILD.gn b/services/apphilogcat/BUILD.gn index 75737a55a2bcd31b11d6e72f921aaaeb2729b614..09cd392f80af68c664f500b23f590179846eab67 100644 --- a/services/apphilogcat/BUILD.gn +++ b/services/apphilogcat/BUILD.gn @@ -13,39 +13,39 @@ import("//build/lite/config/component/lite_component.gni") declare_args() { - ohos_hiviewdfx_hilog_file_size = 1024000 - enable_ohos_hiviewdfx_apphilogcat_init_release = false - enable_ohos_hiviewdfx_apphilogcat_init_debug = true - ohos_hiviewdfx_apphilogcat_log_level_release = 5 - ohos_hiviewdfx_apphilogcat_log_level_debug = 3 + hilog_lite_hilog_file_size = 1024000 + hilog_lite_enable_apphilogcat_init_release = false + hilog_lite_enable_apphilogcat_init_debug = true + hilog_lite_apphilogcat_log_level_release = 5 + hilog_lite_apphilogcat_log_level_debug = 3 apphilogcat_on = 1 apphilogcat_off = 0 - enable_ohos_hiviewdfx_hilogcat_build = true - ohos_hiviewdfx_apphilogcat_log_dir = "/storage/data/log" + hilog_lite_enable_hilogcat_build = true + hilog_lite_apphilogcat_log_dir = "/storage/data/log" } if (ohos_kernel_type != "liteos_m") { config("apphilogcat_config") { - defines = [ "HILOG_MAX_FILELEN = $ohos_hiviewdfx_hilog_file_size" ] + defines = [ "HILOG_MAX_FILELEN = $hilog_lite_hilog_file_size" ] - if (enable_ohos_hiviewdfx_apphilogcat_init_release) { + if (hilog_lite_enable_apphilogcat_init_release) { defines += [ "APPHILOGCAT_STATUS_RELEASE = $apphilogcat_on" ] } else { defines += [ "APPHILOGCAT_STATUS_RELEASE = $apphilogcat_off" ] } - if (enable_ohos_hiviewdfx_apphilogcat_init_debug) { + if (hilog_lite_enable_apphilogcat_init_debug) { defines += [ "APPHILOGCAT_STATUS_DEBUG = $apphilogcat_on" ] } else { defines += [ "APPHILOGCAT_STATUS_DEBUG = $apphilogcat_off" ] } - defines += [ "CONFIG_LOG_LEVEL_RELEASE = $ohos_hiviewdfx_apphilogcat_log_level_release" ] + defines += [ "CONFIG_LOG_LEVEL_RELEASE = $hilog_lite_apphilogcat_log_level_release" ] defines += [ - "CONFIG_LOG_LEVEL_DEBUG = $ohos_hiviewdfx_apphilogcat_log_level_debug", + "CONFIG_LOG_LEVEL_DEBUG = $hilog_lite_apphilogcat_log_level_debug", ] - defines += [ "HILOG_DIR = \"$ohos_hiviewdfx_apphilogcat_log_dir\"" ] + defines += [ "HILOG_DIR = \"$hilog_lite_apphilogcat_log_dir\"" ] } static_library("apphilogcat_static") { @@ -58,7 +58,7 @@ if (ohos_kernel_type != "liteos_m") { ] public_configs = [ ":apphilogcat_config" ] - if (enable_ohos_hiviewdfx_hilogcat_build) { + if (hilog_lite_enable_hilogcat_build) { deps += [ "//base/hiviewdfx/hilog_lite/services/hilogcat:hilogcat" ] } } diff --git a/test/BUILD.gn b/test/BUILD.gn index d66a0af4e48eca9001aac075fb839888a29355e6..61280036e066dbb7fc9d52c5bfb3ccb8ae551478 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -14,8 +14,12 @@ import("//build/lite/config/subsystem/aafwk/path.gni") import("//build/lite/config/test.gni") +declare_args() { + hilog_lite_disable_test = false +} + group("hilog_lite_test") { - if (ohos_build_type == "debug" && ohos_kernel_type != "liteos_m") { + if (ohos_build_type == "debug" && ohos_kernel_type != "liteos_m" && !hilog_lite_disable_test) { deps = [ ":lite_hilog_unittest" ] } }