将日志添加到内核日志

Signed-off-by: fangzhiyi18 <fangzhiyi1@huawei.com>
This commit is contained in:
fangzhiyi18 2023-11-30 11:28:11 +00:00
parent 1978f227cd
commit ba56c5de56
3 changed files with 12 additions and 0 deletions

View File

@ -19,10 +19,19 @@
namespace OHOS {
static constexpr OHOS::HiviewDFX::HiLogLabel LOG_LABEL = { LOG_CORE, LOG_DOMAIN, STORAGE_LOG_TAG};
static constexpr OHOS::HiviewDFX::HiLogLabel KLOG_LABEL = { LOG_KMSG, LOG_DOMAIN, STORAGE_LOG_TAG};
#if defined KMSG_LOG
#define PRINT_LOG(Level, fmt, ...) \
OHOS::HiviewDFX::HiLog::Level(OHOS::LOG_LABEL, "[%{public}s:%{public}d] " fmt, \
__FUNCTION__, __LINE__, ##__VA_ARGS__); \
OHOS::HiviewDFX::HiLog::Level(OHOS::KLOG_LABEL, "[%{public}s:%{public}d] " fmt, \
__FUNCTION__, __LINE__, ##__VA_ARGS__)
#else
#define PRINT_LOG(Level, fmt, ...) \
OHOS::HiviewDFX::HiLog::Level(OHOS::LOG_LABEL, "[%{public}s:%{public}d] " fmt, \
__FUNCTION__, __LINE__, ##__VA_ARGS__)
#endif
#define LOGD(fmt, ...) PRINT_LOG(Debug, fmt, ##__VA_ARGS__)
#define LOGI(fmt, ...) PRINT_LOG(Info, fmt, ##__VA_ARGS__)

View File

@ -72,6 +72,7 @@ ohos_executable("storage_daemon") {
defines = [
"STORAGE_LOG_TAG = \"StorageDaemon\"",
"LOG_DOMAIN = 0xD004301",
"KMSG_LOG",
]
if (storage_service_user_file_sharing) {
@ -179,6 +180,7 @@ ohos_executable("sdc") {
defines = [
"STORAGE_LOG_TAG = \"StorageDaemon\"",
"LOG_DOMAIN = 0xD004301",
"KMSG_LOG",
]
configs = [ ":sdc_config" ]

View File

@ -57,6 +57,7 @@ ohos_static_library("libsdcrypto") {
"LOG_DOMAIN = 0xD004301",
"OPENSSL_SUPPRESS_DEPRECATED",
"USER_CRYPTO_MIGRATE_KEY",
"KMSG_LOG",
]
configs = [ ":storage_daemon_crypto_config" ]