From f25f39e3553104a096ebcdd2b1e2d98a74147089 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B0=B8=E5=BF=A0?= Date: Fri, 24 Nov 2023 10:28:38 +0000 Subject: [PATCH 1/3] log refine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王永忠 --- .../datatransmitmgr/include/dev_slinfo_log.h | 51 +++++++++++++++---- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/interfaces/innerkits/datatransmitmgr/include/dev_slinfo_log.h b/interfaces/innerkits/datatransmitmgr/include/dev_slinfo_log.h index e572d9a..1ab521e 100644 --- a/interfaces/innerkits/datatransmitmgr/include/dev_slinfo_log.h +++ b/interfaces/innerkits/datatransmitmgr/include/dev_slinfo_log.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. + * Copyright (C) 2022-2023 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 @@ -16,18 +16,49 @@ #ifndef DEV_SLINFO_LOG_H #define DEV_SLINFO_LOG_H -#include +#ifdef HILOG_ENABLE + +typedef enum { + LOG_LEVEL_DEBUG = 0, + LOG_LEVEL_INFO = 1, + LOG_LEVEL_WARN = 2, + LOG_LEVEL_ERROR = 3 +} LogLevel; + +#ifdef __cplusplus +extern "C" { +#endif +void DataSlLogPrint(LogLevel level, const char *funName, const char *fmt, ...); + +#ifdef __cplusplus +} +#endif + #include "hilog/log.h" -#ifdef LOG_TAG -#undef LOG_TAG +#ifndef LOG_DOMAIN +#define LOG_DOMAIN 0xD002F10 /* Security subsystem's domain id */ #endif -#define LOG_TAG "DATA_SEC_LEVEL: " -#define DATA_SEC_LOG_DEBUG(fmt, ...) HILOG_DEBUG(LOG_CORE, fmt, ##__VA_ARGS__) -#define DATA_SEC_LOG_INFO(fmt, ...) HILOG_INFO(LOG_CORE, fmt, ##__VA_ARGS__) -#define DATA_SEC_LOG_WARN(fmt, ...) HILOG_WARN(LOG_CORE, fmt, ##__VA_ARGS__) -#define DATA_SEC_LOG_ERROR(fmt, ...) HILOG_ERROR(LOG_CORE, fmt, ##__VA_ARGS__) -#define DATA_SEC_LOG_FATAL(fmt, ...) HILOG_FATAL(LOG_CORE, fmt, ##__VA_ARGS__) +#define DATA_SEC_LOG_DEBUG(fmt, ...) (DataSlLogPrint(LOG_LEVEL_DEBUG, __FUNCTION__, fmt, ##__VA_ARGS__)) +#define DATA_SEC_LOG_INFO(fmt, ...) (DataSlLogPrint(LOG_LEVEL_INFO, __FUNCTION__, fmt, ##__VA_ARGS__)) +#define DATA_SEC_LOG_WARN(fmt, ...) (DataSlLogPrint(LOG_LEVEL_WARN, __FUNCTION__, fmt, ##__VA_ARGS__)) +#define DATA_SEC_LOG_ERROR(fmt, ...) (DataSlLogPrint(LOG_LEVEL_ERROR, __FUNCTION__, fmt, ##__VA_ARGS__)) + +#define DataSl_LOG_DEBUG(fmt, ...) HiLogPrint(LOG_CORE, LOG_DEBUG, LOG_DOMAIN, "[DataSl]", "%{public}s", buf) +#define DataSl_LOG_INFO(buf) HiLogPrint(LOG_CORE, LOG_INFO, LOG_DOMAIN, "[DataSl]", "%{public}s", buf) +#define DataSl_LOG_WARN(buf) HiLogPrint(LOG_CORE, LOG_WARN, LOG_DOMAIN, "[DataSl]", "%{public}s", buf) +#define DataSl_LOG_ERROR(buf) HiLogPrint(LOG_CORE, LOG_ERROR, LOG_DOMAIN, "[DataSl]", "%{public}s", buf) + +#else + +#include + +#define DATA_SEC_LOG_DEBUG(fmt, ...) printf("[DataSl][D][%s]: " fmt "\n", __FUNCTION__, ##__VA_ARGS__) +#define DATA_SEC_LOG_INFO(fmt, ...) printf("[DataSl][I][%s]: " fmt "\n", __FUNCTION__, ##__VA_ARGS__) +#define DATA_SEC_LOG_WARN(fmt, ...) printf("[DataSl][W][%s]: " fmt "\n", __FUNCTION__, ##__VA_ARGS__) +#define DATA_SEC_LOG_ERROR(fmt, ...) printf("[DataSl][E][%s]: " fmt "\n", __FUNCTION__, ##__VA_ARGS__) + +#endif #endif \ No newline at end of file -- Gitee From 97fbb8f71b14e0eb156ee1bbf75c46e0b10fccdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B0=B8=E5=BF=A0?= Date: Fri, 24 Nov 2023 10:29:11 +0000 Subject: [PATCH 2/3] log refine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王永忠 --- interfaces/innerkits/datatransmitmgr/include/dev_slinfo_log.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/innerkits/datatransmitmgr/include/dev_slinfo_log.h b/interfaces/innerkits/datatransmitmgr/include/dev_slinfo_log.h index 1ab521e..6a25776 100644 --- a/interfaces/innerkits/datatransmitmgr/include/dev_slinfo_log.h +++ b/interfaces/innerkits/datatransmitmgr/include/dev_slinfo_log.h @@ -38,7 +38,7 @@ void DataSlLogPrint(LogLevel level, const char *funName, const char *fmt, ...); #include "hilog/log.h" #ifndef LOG_DOMAIN -#define LOG_DOMAIN 0xD002F10 /* Security subsystem's domain id */ +#define LOG_DOMAIN 0xD002F10 #endif #define DATA_SEC_LOG_DEBUG(fmt, ...) (DataSlLogPrint(LOG_LEVEL_DEBUG, __FUNCTION__, fmt, ##__VA_ARGS__)) -- Gitee From 07e6acd4381bcf52419885e28f71359174b26016 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B0=B8=E5=BF=A0?= Date: Sat, 25 Nov 2023 03:19:21 +0000 Subject: [PATCH 3/3] modify log MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王永忠 --- interfaces/innerkits/datatransmitmgr/include/dev_slinfo_log.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/innerkits/datatransmitmgr/include/dev_slinfo_log.h b/interfaces/innerkits/datatransmitmgr/include/dev_slinfo_log.h index 6a25776..920c365 100644 --- a/interfaces/innerkits/datatransmitmgr/include/dev_slinfo_log.h +++ b/interfaces/innerkits/datatransmitmgr/include/dev_slinfo_log.h @@ -38,7 +38,7 @@ void DataSlLogPrint(LogLevel level, const char *funName, const char *fmt, ...); #include "hilog/log.h" #ifndef LOG_DOMAIN -#define LOG_DOMAIN 0xD002F10 +#define LOG_DOMAIN 0xD002F04 #endif #define DATA_SEC_LOG_DEBUG(fmt, ...) (DataSlLogPrint(LOG_LEVEL_DEBUG, __FUNCTION__, fmt, ##__VA_ARGS__)) -- Gitee