[Feature][R305][task-view-1811][log] Modifying the size of the log file can be configured through nv
Change-Id: I31db25471319359ceebb865051b54b92d31d93e2
diff --git a/lynq/R305/ap/lib/libsoftap/softap_log.c b/lynq/R305/ap/lib/libsoftap/softap_log.c
index 6cadda4..e193836 100755
--- a/lynq/R305/ap/lib/libsoftap/softap_log.c
+++ b/lynq/R305/ap/lib/libsoftap/softap_log.c
@@ -21,6 +21,7 @@
int slog_sysloglevel = SLOG_OFF;
int soctime_sw = SLOG_SOCTIME_OFF;
int g_open_lynq_log = 0;
+int g_lynq_log_size = 102400; // 100KB
int log_switch = LOG_ON;
long long time_us;
@@ -77,13 +78,16 @@
char nv_syslog_level[32] = {0};
char nv_soctime_switch[32] = {0};
char open_lynq_log[8] = {0};
+ char lynq_log_size[8] = {0};
cfg_get_item("print_level", nv_print_level, sizeof(nv_print_level));
cfg_get_item("syslog_level", nv_syslog_level, sizeof(nv_syslog_level));
cfg_get_item("soctime_switch", nv_soctime_switch, sizeof(nv_soctime_switch));
cfg_get_item("open_lynq_log", open_lynq_log, sizeof(open_lynq_log));
+ cfg_get_item("lynq_log_size", lynq_log_size, sizeof(lynq_log_size));
g_open_lynq_log = atoi(open_lynq_log);
+ g_lynq_log_size = atoi(lynq_log_size);
//loglevel·ÇÓÐЧֵʱ£¬½«Ä¬ÈÏ´òÓ¡¼¶±ðÉèÖÃΪoff£¬¼´¹Ø±Õ´òÓ¡
slog_printlevel = atoi(nv_print_level);
@@ -121,7 +125,6 @@
#define LYNQ_LOG_FILE_PATH "/cache/lynqlog"
#define LYNQ_LOG_FILE_BACKUP "/cache/lynqlog.0"
-#define LYNQ_LOG_FILE_MAX_SIZE (100 * 1024) // 100KB
#define put_to_console(mod, fmt, arg) do {\
char buf[1024] = {0}; \
@@ -137,7 +140,7 @@
if (1 == g_open_lynq_log) \
{\
struct stat st; \
- if (stat(LYNQ_LOG_FILE_PATH, &st) == 0 && st.st_size >= LYNQ_LOG_FILE_MAX_SIZE) \
+ if (stat(LYNQ_LOG_FILE_PATH, &st) == 0 && st.st_size >= g_lynq_log_size) \
{ \
rename(LYNQ_LOG_FILE_PATH, LYNQ_LOG_FILE_BACKUP); \
} \