From b518a3f6fb59bba741bc38a121fd39482dd2182f Mon Sep 17 00:00:00 2001 From: shenchenkai Date: Sat, 25 Sep 2021 18:46:57 +0800 Subject: [PATCH] Description:[feature] support customize hilog dir Change-Id: Ic53f6ee330827af6fbcdfd40629e3e6ece9edb34 --- services/apphilogcat/BUILD.gn | 3 +++ services/apphilogcat/hiview_applogcat.c | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/services/apphilogcat/BUILD.gn b/services/apphilogcat/BUILD.gn index 0d471d4..6d314e5 100755 --- a/services/apphilogcat/BUILD.gn +++ b/services/apphilogcat/BUILD.gn @@ -21,6 +21,7 @@ declare_args() { apphilogcat_on = 1 apphilogcat_off = 0 enable_ohos_hiviewdfx_hilogcat_build = true + ohos_hiviewdfx_apphilogcat_log_dir = "/storage/data/log" } config("apphilogcat_config"){ @@ -41,6 +42,8 @@ config("apphilogcat_config"){ defines += ["CONFIG_LOG_LEVEL_RELEASE = $ohos_hiviewdfx_apphilogcat_log_level_release"] defines += ["CONFIG_LOG_LEVEL_DEBUG = $ohos_hiviewdfx_apphilogcat_log_level_debug"] + + defines += ["HILOG_DIR = $ohos_hiviewdfx_apphilogcat_log_dir"] } static_library("apphilogcat_static") { diff --git a/services/apphilogcat/hiview_applogcat.c b/services/apphilogcat/hiview_applogcat.c index 696d422..3bf2ff9 100755 --- a/services/apphilogcat/hiview_applogcat.c +++ b/services/apphilogcat/hiview_applogcat.c @@ -20,8 +20,11 @@ #include "hilog_command.h" #define HILOG_LOGBUFFER 2048 -#define HILOG_PATH1 "/storage/data/log/hilog1.txt" -#define HILOG_PATH2 "/storage/data/log/hilog2.txt" +#ifndef HILOG_DIR +#define HILOG_DIR "/storage/data/log" +#endif +#define HILOG_PATH1 HILOG_DIR "/hilog1.txt" +#define HILOG_PATH2 HILOG_DIR "/hilog2.txt" #undef LOG_TAG #define LOG_TAG "apphilogcat" -- Gitee