From 86777773919c53dfd5d2b8abe406f4e64c5998fb Mon Sep 17 00:00:00 2001 From: Youngjae Cho Date: Tue, 24 Nov 2020 13:59:59 +0900 Subject: [PATCH] Make critical-log configurable Change-Id: I67eb3788a78f5ce02dacb85f8c3398d5f54fd947 Signed-off-by: Youngjae Cho --- CMakeLists.txt | 2 +- conf/critical-log.conf | 13 ------------- packaging/deviced.spec | 1 + src/shared/log-macro.h | 6 ++++++ 4 files changed, 8 insertions(+), 14 deletions(-) delete mode 100644 conf/critical-log.conf diff --git a/CMakeLists.txt b/CMakeLists.txt index 6bfcc69..b104d6e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -282,7 +282,7 @@ IF(USB_MODULE STREQUAL on) ENDIF() IF(CRITICAL_LOG_MODULE STREQUAL on) - INSTALL_CONF(conf critical-log) + ADD_DEFINITIONS("-DCRITICAL_LOG_ON") ENDIF() CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) diff --git a/conf/critical-log.conf b/conf/critical-log.conf deleted file mode 100644 index 0f76445..0000000 --- a/conf/critical-log.conf +++ /dev/null @@ -1,13 +0,0 @@ -#Critical Log will be saved under the /var/log/ghost/boot/#booting_count -#Critical Log Format is "Section|String Value" -#Limit means Last Critical Log Logging Count -[Common] -Limit=100 -[Battery] -Limit=20 -[BatteryHealth] -Limit=10 -[PowerHandle] -Limit=10 -[CoolDown] -Limit=10 diff --git a/packaging/deviced.spec b/packaging/deviced.spec index db438a9..bd7d771 100644 --- a/packaging/deviced.spec +++ b/packaging/deviced.spec @@ -165,6 +165,7 @@ Plugin libraries for IoT devices -DTOUCH_SENSITIVITY_MODULE=on \ -DDUMP_MODULE=on \ -DDEVICE_BOARD_MODULE=on \ + -DCRITICAL_LOG_MODULE=on \ #eol %build diff --git a/src/shared/log-macro.h b/src/shared/log-macro.h index 773ea44..440300f 100644 --- a/src/shared/log-macro.h +++ b/src/shared/log-macro.h @@ -22,9 +22,14 @@ #ifdef ENABLE_DLOG #include + /* critical log */ +#ifdef CRITICAL_LOG_ON #define CRITICAL_LOG(fmt, arg...) \ do { CRITICAL_LOG_(LOG_ID_SYSTEM, DLOG_INFO, LOG_TAG, fmt, ##arg); } while (0) +#else +#define CRITICAL_LOG(fmt, arg...) _I(fmt, ##arg) +#endif #define _D(fmt, arg...) \ do { SLOGD(fmt, ##arg); } while (0) @@ -43,6 +48,7 @@ #define _SE(fmt, arg...) \ do { SECURE_SLOGE(fmt, ##arg); } while (0) #else +#define CRITICAL_LOG(...) do { } while (0) #define _D(...) do { } while (0) #define _I(...) do { } while (0) #define _W(...) do { } while (0) -- 2.7.4