libsyscommon: Add CRITICAL_LOG() 78/297378/1
authorYoungjae Cho <y0.cho@samsung.com>
Thu, 17 Aug 2023 11:30:14 +0000 (20:30 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Thu, 17 Aug 2023 11:30:14 +0000 (20:30 +0900)
It requires macro definition ENABLE_DLOG and CRITICAL_LOG_ON.

Change-Id: Ic25393d9c96cd24047cff33cdaf72a25cf627706
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
include/libsyscommon/log.h

index 0d7db18..59fdb08 100644 (file)
 #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__ */