From 9ebe7bc5c583fe49a8d56af241ef6044c63dd286 Mon Sep 17 00:00:00 2001 From: Youngjae Cho Date: Thu, 17 Aug 2023 20:30:14 +0900 Subject: [PATCH] libsyscommon: Add CRITICAL_LOG() It requires macro definition ENABLE_DLOG and CRITICAL_LOG_ON. Change-Id: Ic25393d9c96cd24047cff33cdaf72a25cf627706 Signed-off-by: Youngjae Cho --- include/libsyscommon/log.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/include/libsyscommon/log.h b/include/libsyscommon/log.h index 0d7db18..59fdb08 100644 --- a/include/libsyscommon/log.h +++ b/include/libsyscommon/log.h @@ -31,11 +31,27 @@ #define _I(fmt, args...) SLOGI(fmt, ##args) #define _W(fmt, args...) SLOGW(fmt, ##args) #define _E(fmt, args...) SLOGE(fmt, ##args) -#else + +#ifdef CRITICAL_LOG_ON +#define CRITICAL_LOG(fmt, arg...) \ + do { CRITICAL_LOG_(LOG_ID_SYSTEM, DLOG_INFO, LOG_TAG, fmt, ##arg); } while (0) +#define CRITICAL_LOG_E(fmt, arg...) \ + do { CRITICAL_LOG_(LOG_ID_SYSTEM, DLOG_ERROR, LOG_TAG, fmt, ##arg); } while (0) +#else /* CRITICAL_LOG_ON */ +#define CRITICAL_LOG(fmt, arg...) _I(fmt, ##arg) +#define CRITICAL_LOG_E(fmt, arg...) _E(fmt, ##arg) +#endif /* CRITICAL_LOG_ON */ + +#else /* ENABLE_DLOG */ + #define _D(fmt, args...) do { } while(0) #define _I(fmt, args...) do { } while(0) #define _W(fmt, args...) do { } while(0) #define _E(fmt, args...) do { } while(0) -#endif + +#define CRITICAL_LOG(fmt, arg...) _I(fmt, ##arg) +#define CRITICAL_LOG_E(fmt, arg...) _E(fmt, ##arg) + +#endif /* ENABLE_DLOG */ #endif /* __LOG_H__ */ -- 2.7.4