[Feature][ZXW-320] fix the question of Setting the log output level to 4, and the log data is still increasing
Only Configure :No
Affected branch: master
Affected module: log
Is it affected on both ZXIC and MTK:only ZXIC
Self-test: Yes
Doc Update: No
Change-Id: Ib5ef5e8053a8411c4a7d7f853335c6a359d76872
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/binder/include/log/logd.h b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/binder/include/log/logd.h
index 9fbcbc5..973cb60 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/binder/include/log/logd.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/binder/include/log/logd.h
@@ -38,6 +38,13 @@
extern "C" {
#endif
+/*cz.li add on 2024/7/8 for control RLOGD start*/
+#define SLOG_DEBUG 1 //研发个体行为log输出,量很大
+#define SLOG_NORMAL 2 //集成测试阶段log输出,量适中
+#define SLOG_ERR 3 //致命或快照类log输出,量小
+#define SLOG_OFF 4 //全部关闭打印
+/*cz.li add on 2024/7/8 for control RLOGD start*/
+
int __android_log_bwrite(int32_t tag, const void *payload, size_t len);
int __android_log_btwrite(int32_t tag, char type, const void *payload,
size_t len);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/binder/liblog/logd_write.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/binder/liblog/logd_write.c
index dbe869f..5b30e8d 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/binder/liblog/logd_write.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/binder/liblog/logd_write.c
@@ -440,7 +440,7 @@
return LOG_NAME[log_id];
}
#endif
-
+int sys_log_levle = -1;
static int __write_to_log_init(log_id_t log_id, struct iovec *vec, size_t nr)
{
#ifdef HAVE_PTHREADS
@@ -466,7 +466,38 @@
#ifdef HAVE_PTHREADS
pthread_mutex_unlock(&log_init_lock);
#endif
-
+/*cz.li add on 2024/7/8 for control RLOGD start*/
+ char nv_syslog_level[10];
+ char buffer[32];
+ FILE *output = popen("nv show | grep syslog_level", "r");
+ while (fgets(buffer, sizeof(buffer), output) != NULL)
+ {
+ char *equal_sign = strchr(buffer, '=');
+ strncpy(nv_syslog_level,equal_sign + 1,1);
+ }
+ pclose(output);
+ sys_log_levle = atoi(nv_syslog_level);
+ if(sys_log_levle == SLOG_DEBUG)
+ {
+ sys_log_levle = ANDROID_LOG_DEBUG;
+ }
+ else if(sys_log_levle == SLOG_NORMAL)
+ {
+ sys_log_levle = ANDROID_LOG_INFO;
+ }
+ else if(sys_log_levle == SLOG_ERR)
+ {
+ sys_log_levle = ANDROID_LOG_ERROR;
+ }
+ else if(sys_log_levle == SLOG_OFF)
+ {
+ sys_log_levle = ANDROID_LOG_SILENT;
+ }
+ else
+ {
+ sys_log_levle = ANDROID_LOG_INFO;
+ }
+/*cz.li add on 2024/7/8 for control RLOGD end*/
return write_to_log(log_id, vec, nr);
}
@@ -517,7 +548,12 @@
{
struct iovec vec[3];
char tmp_tag[32];
-
+/*cz.li add on 2024/7/8 for control RLOGD start*/
+ if(prio < sys_log_levle)
+ {
+ return 0;
+ }
+/*cz.li add on 2024/7/8 for control RLOGD end*/
if (!tag)
tag = "";