Merge "Revert "[Feature][T106BUG-76] change log system implement & log level control""
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-log/liblynq-log.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-log/liblynq-log.bb
index 3400fdd..cf8b12d 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-log/liblynq-log.bb
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-log/liblynq-log.bb
@@ -6,7 +6,7 @@
 LICENSE = "CLOSED"

 LIC_FILES_CHKSUM = "file://LICENSE;md5=e1696b147d49d491bcb4da1a57173fff"

 #DEPENDS += "platform-libs libpal nandapi liblynq-uci"

-DEPENDS += "${@bb.utils.contains('TARGET_PLATFORM', 'T106', "libnvram", '', d)} liblynq-uci libbinder"

+DEPENDS += "liblynq-uci libbinder"

 #inherit workonsrc

 WORKONSRC = "${TOPDIR}/../src/lynq/lib/liblynq-log"

 FILESEXTRAPATHS_prepend :="${TOPDIR}/../src/lynq/lib/:"

diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ril.cpp b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ril.cpp
index bde5a93..c23afae 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ril.cpp
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ril.cpp
@@ -7828,8 +7828,6 @@
 #endif /* KEEP_ALIVE*/
 } /* namespace android */
 
-DEFINE_LYNQ_EXE_LOG(LYNQ_RIL)
-
 #if 0
 void rilEventAddWakeup_helper(struct ril_event *ev) {
     android::rilEventAddWakeup(ev);
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call.cpp
index 0dc22bc..b775838 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call.cpp
@@ -1503,8 +1503,6 @@
     }

 }

 

-DEFINE_LYNQ_LIB_LOG(LYNQ_CALL)

-

 #if 0

 int main(int argc,char **argv)

 {

diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-data/lynq_data.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-data/lynq_data.cpp
index 975db3a..97b72b0 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-data/lynq_data.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-data/lynq_data.cpp
@@ -1995,6 +1995,3 @@
 {
     pthread_cond_signal(&s_lynq_urc_vector_cond);
 }
-
-DEFINE_LYNQ_LIB_LOG(LYNQ_DATA)
-
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-log/include/liblog/liblog.h b/cap/zx297520v3/src/lynq/lib/liblynq-log/include/liblog/liblog.h
index c9772b4..03b183a 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-log/include/liblog/liblog.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-log/include/liblog/liblog.h
@@ -5,6 +5,14 @@
 extern "C" {
 #endif
 
+#define LOG_ENABLE  1      
+
+//#if LOG_ENABLE
+#if LOG_ENABLE
+
+#define ENABLE(X)               (1<<(X))
+#define LOG_LEVEL_ENABLE      	  ENABLE(LOG_VERBOSE)
+
 typedef enum
 {
     LOG_VERBOSE = 0,   
@@ -15,9 +23,15 @@
     LOG_LEVEL_MAX
 }log_level_enum;
 
+const static char * LogLevelNameInfoTable[LOG_LEVEL_MAX] =
+{
+    "[VERBOSE]","[ERROR]","[WARNING]","[INFO]","[DEBUG]" //lt add @2021.7.22 for []
+};
+#endif //LOG_ENABLE
+
 void lynq_log_global_output(log_level_enum Level,const char *format,...);
+void lynq_log_configuration_set(char *log_name,char log_data_arr);
 void lynq_log_configuration_init(char *log_name);
-const char* lynq_read_log_version();
 #ifdef __cplusplus
 }
 #endif
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-log/include/liblog/lynq_deflog.h b/cap/zx297520v3/src/lynq/lib/liblynq-log/include/liblog/lynq_deflog.h
index 3fecfc7..667ae1a 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-log/include/liblog/lynq_deflog.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-log/include/liblog/lynq_deflog.h
@@ -6,68 +6,36 @@
 extern "C" {

 #endif

 

-typedef void (*LYNQ_WRITE_LOG_PTR)(log_level_enum level, const char *format, ...);

-extern LYNQ_WRITE_LOG_PTR lynq_write_log;

-LYNQ_WRITE_LOG_PTR lynq_log_function_init(const char *log_name);

+void lynq_log_configuration_init(char *log_name);

+void lynq_log_configuration_set(char *log_name,char log_data_arr);

+void lynq_log_verbose(const char *format,...);

+void lynq_log_error(const char *format,...);

+void lynq_log_warning(const char *format,...);

+void lynq_log_info(const char *format,...);

+void lynq_log_debug(const char *format,...);

 

-int lynq_syslog_set_file_size(int value);

-int lynq_syslog_get_file_size(void);

-int lynq_syslog_set_file_rotate(int value);

-int lynq_syslog_get_file_rotate(void);

 

+#ifndef USER_LOG_TAG 

+#define LYVERBLOG(X...)  lynq_log_global_output(LOG_VERBOSE,X)

+#define LYERRLOG(X...)  lynq_log_global_output(LOG_ERROR,X)

+#define LYWARNLOG(X...)  lynq_log_global_output(LOG_WARNING,X)

+#define LYINFLOG(X...)  lynq_log_global_output(LOG_INFO,X)

+#define LYDBGLOG(X...)  lynq_log_global_output(LOG_DEBUG,X)

+#define LYLOGSET(a) lynq_log_configuration_set(USER_LOG_TAG,a)

+#define LYLOGEINIT(Y) lynq_log_configuration_init(Y)

+#else

+#define LYVERBLOG(X...)  

+#define LYERRLOG(X...)  

+#define LYWARNLOG(X...)  

+#define LYINFLOG(X...)  

+#define LYDBGLOG(X...)  

+#define LYLOGSET(a)

+#define LYLOGEINIT(Y)

+#endif

+

+char* lynq_read_log_version();

 #ifdef __cplusplus

 }

 #endif

 

-#define lynq_log_verbose(...)  do { lynq_write_log(LOG_VERBOSE,__VA_ARGS__);} while (0)

-#define lynq_log_error(...)  do {lynq_write_log(LOG_ERROR,__VA_ARGS__);} while (0)

-#define lynq_log_warning(...)  do {lynq_write_log(LOG_WARNING,__VA_ARGS__);} while (0)

-#define lynq_log_info(...)  do {lynq_write_log(LOG_INFO,__VA_ARGS__);} while (0)

-#define lynq_log_debug(...)  do {lynq_write_log(LOG_DEBUG,__VA_ARGS__);} while (0)

-

-#define LYVERBLOG(...)  do {lynq_write_log(LOG_VERBOSE,__VA_ARGS__);} while (0)

-#define LYERRLOG(...)  do {lynq_write_log(LOG_ERROR,__VA_ARGS__);} while (0)

-#define LYWARNLOG(...)  do {lynq_write_log(LOG_WARNING,__VA_ARGS__);} while(0)

-#define LYINFLOG(...)  do {lynq_write_log(LOG_INFO,__VA_ARGS__);} while (0)

-#define LYDBGLOG(...)  do {lynq_write_log(LOG_DEBUG,__VA_ARGS__);} while (0)

-

-// just for comcompatibility, do nothing

-#define LYLOGSET(a) do{;}while(0)

-#define LYLOGEINIT(Y) do{;}while(0)

-

-#ifndef ALOGV

-#define ALOGV(...) do {lynq_write_log(LOG_VERBOSE,__VA_ARGS__);} while (0)

-#endif

-

-#ifndef ALOGE

-#define ALOGE(...) do {lynq_write_log(LOG_ERROR,__VA_ARGS__);} while (0)

-#endif

-

-#ifndef ALOGW

-#define ALOGW(...) do {lynq_write_log(LOG_WARNING,__VA_ARGS__);} while (0)

-#endif

-

-#ifndef ALOGI

-#define ALOGI(...) do {lynq_write_log(LOG_INFO,__VA_ARGS__);} while (0)

-#endif

-

-#ifndef ALOGD

-#define ALOGD(...) do {lynq_write_log(LOG_DEBUG,__VA_ARGS__);} while (0)

-#endif

-

-#define DEFINE_LYNQ_LIB_LOG(tag) \

-    LYNQ_WRITE_LOG_PTR __attribute__ ((visibility ("hidden"))) lynq_write_log = NULL; \

-    void __attribute__((constructor)) tag##_init() \

-    { \

-        lynq_write_log = lynq_log_function_init(#tag); \

-    }

-

-#define DEFINE_LYNQ_EXE_LOG(tag) \

-    LYNQ_WRITE_LOG_PTR __attribute__ ((visibility ("hidden"))) lynq_write_log = NULL; \

-    void __attribute__((constructor)) tag##_init() \

-    { \

-        lynq_write_log = lynq_log_function_init(#tag); \

-        lynq_log_configuration_init(#tag); \

-    }

-

-#endif  //__LYNQ_DEFLOG_H__

+#endif  //__LYNQ_DEFLOG_H__
\ No newline at end of file
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-log/log-riltel/log.c b/cap/zx297520v3/src/lynq/lib/liblynq-log/log-riltel/log.c
new file mode 100755
index 0000000..c59374b
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-log/log-riltel/log.c
@@ -0,0 +1,367 @@
+#include "liblog.h"
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h> 
+#include <unistd.h>
+#include <string.h>
+#include <log/log.h>
+#include <include/lynq_uci.h>
+
+#define LOG_NAME_LEN 128
+#define LOG_OUT_LEN 2*1024+100 //lt add @2021.9.22 for write outbuf define len 
+#define LOG_LEN 2*1024 //lt add @2021.9.22 for write buf define len 
+#define LOG_UCI_MODULE "lynq_log"
+#define LOG_UCI_FILE "lynq_uci"
+static unsigned int log_level = 0; 
+static unsigned char log_name_arr[LOG_NAME_LEN] = {0};
+
+int lynq_log_set_value(char *key, char *value);
+int lynq_log_get_value(char *key, char *tmp);
+
+void lynq_log_global_output(log_level_enum Level,const char *format,...)
+{
+#if LOG_ENABLE
+
+    char out_buf[LOG_OUT_LEN] = {0};    
+    char buf[LOG_LEN] = {0};
+	
+    if(Level >=  LOG_LEVEL_MAX)
+        return;
+    if((log_level >> Level)&0x00000001)
+    {
+        va_list args;
+        //TagName
+        if(log_name_arr[0]  > 0)
+        {
+		printf("[%s]",log_name_arr);
+	 }
+        
+        //LevelName
+        printf("%s:",LogLevelNameInfoTable[Level]); //lt dele @2021.7.22 for []
+
+        va_start(args,format);
+        vprintf(format,args);
+        vsnprintf(buf, sizeof(buf), format, args);  //lt add @2021.7.22 for write buf
+        va_end(args);
+        printf("\r\n");
+
+        sprintf(out_buf, "%s %s", LogLevelNameInfoTable[Level], buf);//lt add @2021.7.22 for write outbuf
+        switch(Level) //lt mod @2021.9.22 for matching MTK log level 
+        {
+            case LOG_VERBOSE:
+                __android_log_print(ANDROID_LOG_VERBOSE,log_name_arr, "%s",out_buf); //lt add @2021.9.22 for write syslog.log		
+                break;
+            case LOG_ERROR:
+                __android_log_print(ANDROID_LOG_ERROR,log_name_arr, "%s",out_buf); //lt add @2021.9.22 for write syslog.log		
+                break;
+            case LOG_WARNING:
+                __android_log_print(ANDROID_LOG_WARN,log_name_arr, "%s",out_buf); //lt add @2021.9.22 for write syslog.log		
+                break;		
+            case LOG_INFO:
+                __android_log_print(ANDROID_LOG_INFO,log_name_arr, "%s",out_buf); //lt add @2021.9.22 for write syslog.log		
+                break;
+            case LOG_DEBUG:
+                __android_log_print(ANDROID_LOG_DEBUG,log_name_arr, "%s",out_buf); //lt add @2021.7.22 for write syslog.log		
+                break;
+            default :
+                __android_log_print(ANDROID_LOG_DEBUG,log_name_arr, "Log Level is Error!!!!!!"); //lt add @2021.9.22 for write syslog.log		
+                break;
+        }
+	
+    }
+    return ;
+#endif //LOG_ENABLE
+}
+
+void lynq_log_configuration_set(char *log_name,char log_data_arr)
+{
+    char log_data_str[32] = {0};
+    if(log_name == NULL)
+    {
+        return ;
+    }
+    if(log_data_arr < LOG_LEVEL_MAX)
+    {
+        sprintf(log_data_str,"%d",log_data_arr);
+        if((strlen(log_name)) < LOG_NAME_LEN)
+        {
+            lynq_log_set_value(log_name, log_data_str);//lt mod @2021.8.3 for uci
+        }
+    }
+    lynq_log_configuration_init(log_name);  
+    return ;
+}
+
+void lynq_deal_with_level(unsigned int get_log_level)
+{
+    switch(get_log_level)
+    {
+        case LOG_DEBUG:
+            log_level |= ENABLE(LOG_DEBUG);
+        case LOG_INFO:
+            log_level |= ENABLE(LOG_INFO);
+        case LOG_WARNING:
+            log_level |= ENABLE(LOG_WARNING);
+        case LOG_ERROR:
+            log_level |= ENABLE(LOG_ERROR);
+        case LOG_VERBOSE:
+            log_level |= ENABLE(LOG_VERBOSE);
+            break;
+        default:
+            log_level |= ENABLE(LOG_VERBOSE);
+            break;
+    }
+    return ;
+}
+
+void lynq_log_configuration_init(char *log_name)
+{
+    char get_propty_log_data[32] ={0};
+    unsigned int get_log_level = 0;
+    if(log_name == NULL)
+    {
+        return ;
+    }
+    if((strlen(log_name)) < LOG_NAME_LEN)
+    {
+        strcpy(log_name_arr,log_name);
+        if(0 == lynq_log_get_value(log_name,get_propty_log_data))//lt mod @2021.8.3 for uci
+        {
+            get_log_level = atoi(get_propty_log_data);
+        }
+        else
+        {
+            lynq_log_configuration_set(log_name, get_log_level);//lt add @2021.09.06 for uci
+        }
+    }
+    lynq_deal_with_level(get_log_level);
+    return ;
+}
+
+//lt add @2021.8.3 for in encapsulating the UCI set function
+int lynq_log_set_value(char *key, char *value)
+{
+    return lynq_set_value(LOG_UCI_MODULE, key, value);
+}
+
+//lt add @2021.8.3 for in encapsulating the UCI get function
+int lynq_log_get_value(char *key, char *tmp)
+{
+	return lynq_get_value(LOG_UCI_FILE, LOG_UCI_MODULE, key, tmp);
+}
+
+//lt add @2022.1.5 for  add fota lib name.
+char* lynq_read_log_version()
+{
+	return "LOG-V1.0";
+}
+
+/**
+ * @brief Verbose logs are printed and stored
+ * 
+ * @param log data
+ * @return void 
+ */
+void lynq_log_verbose(const char *format,...)
+{
+#if LOG_ENABLE
+
+    char out_buf[LOG_OUT_LEN] = {0};    
+    char buf[LOG_LEN] = {0};
+    log_level_enum lynq_level = LOG_VERBOSE;
+    
+    if(lynq_level >=  LOG_LEVEL_MAX)
+        return;
+    if((log_level >> lynq_level)&0x00000001)
+    {
+        va_list args;
+        //TagName
+        if(log_name_arr[0]  > 0)
+        {
+            printf("[%s]",log_name_arr);
+        }
+
+        //LevelName
+        printf("%s:",LogLevelNameInfoTable[lynq_level]); //lt dele @2021.7.22 for []
+
+        va_start(args,format);
+        vprintf(format,args);
+        vsnprintf(buf, sizeof(buf), format, args);  //lt add @2021.7.22 for write buf
+        va_end(args);
+        printf("\r\n");
+
+        sprintf(out_buf, "%s %s",LogLevelNameInfoTable[lynq_level], buf);//lt add @2021.7.22 for write outbuf
+        __android_log_print(ANDROID_LOG_VERBOSE,log_name_arr, "%s",out_buf); //lt add @2021.9.22 for write syslog.log		
+    }
+    return ;
+#endif //LOG_ENABLE
+}
+
+/**
+ * @brief Error logs are printed and stored
+ * 
+ * @param log data
+ * @return void 
+ */
+void lynq_log_error(const char *format,...)
+{
+#if LOG_ENABLE
+
+    char out_buf[LOG_OUT_LEN] = {0};    
+    char buf[LOG_LEN] = {0};
+    log_level_enum lynq_level = LOG_ERROR;
+
+    if(lynq_level >=  LOG_LEVEL_MAX)
+        return;
+    if((log_level >> lynq_level)&0x00000001)
+    {
+        va_list args;
+        //TagName
+        if(log_name_arr[0]  > 0)
+        {
+            printf("[%s]",log_name_arr);
+        }
+
+        //LevelName
+        printf("%s:",LogLevelNameInfoTable[lynq_level]); //lt dele @2021.7.22 for []
+
+        va_start(args,format);
+        vprintf(format,args);
+        vsnprintf(buf, sizeof(buf), format, args);  //lt add @2021.7.22 for write buf
+        va_end(args);
+        printf("\r\n");
+
+        sprintf(out_buf, "%s %s",LogLevelNameInfoTable[lynq_level], buf);//lt add @2021.7.22 for write outbuf
+        __android_log_print(ANDROID_LOG_ERROR,log_name_arr, "%s",out_buf); //lt add @2021.9.22 for write syslog.log		
+    }
+    return ;
+#endif //LOG_ENABLE
+    return ;
+}
+
+/**
+ * @brief Warning logs are printed and stored
+ * 
+ * @param log data
+ * @return void 
+ */
+void lynq_log_warning(const char *format,...)
+{
+ #if LOG_ENABLE
+
+    char out_buf[LOG_OUT_LEN] = {0};    
+    char buf[LOG_LEN] = {0};
+    log_level_enum lynq_level = LOG_WARNING;
+
+    if(lynq_level >=  LOG_LEVEL_MAX)
+        return;
+    if((log_level >> lynq_level)&0x00000001)
+    {
+        va_list args;
+        //TagName
+        if(log_name_arr[0]  > 0)
+        {
+            printf("[%s]",log_name_arr);
+        }
+
+        //LevelName
+        printf("%s:",LogLevelNameInfoTable[lynq_level]); //lt dele @2021.7.22 for []
+
+        va_start(args,format);
+        vprintf(format,args);
+        vsnprintf(buf, sizeof(buf), format, args);  //lt add @2021.7.22 for write buf
+        va_end(args);
+        printf("\r\n");
+
+        sprintf(out_buf, "%s %s",LogLevelNameInfoTable[lynq_level], buf);//lt add @2021.7.22 for write outbuf
+        __android_log_print(ANDROID_LOG_WARN,log_name_arr, "%s",out_buf); //lt add @2021.9.22 for write syslog.log		
+    }
+    return ;
+#endif //LOG_ENABLE
+    return ;
+}
+
+/**
+ * @brief Info logs are printed and stored
+ * 
+ * @param log data
+ * @return void 
+ */
+void lynq_log_info(const char *format,...)
+{
+ #if LOG_ENABLE
+
+    char out_buf[LOG_OUT_LEN] = {0};    
+    char buf[LOG_LEN] = {0};
+    log_level_enum lynq_level = LOG_INFO;
+
+    if(lynq_level >=  LOG_LEVEL_MAX)
+        return;
+    if((log_level >> lynq_level)&0x00000001)
+    {	
+        va_list args;
+        //TagName
+        if(log_name_arr[0]  > 0)
+        {
+            printf("[%s]",log_name_arr);
+        }
+
+        //LevelName
+        printf("%s:",LogLevelNameInfoTable[lynq_level]); //lt dele @2021.7.22 for []
+
+        va_start(args,format);
+        vprintf(format,args);
+        vsnprintf(buf, sizeof(buf), format, args);  //lt add @2021.7.22 for write buf
+        va_end(args);
+        printf("\r\n");
+
+        sprintf(out_buf, "%s %s",LogLevelNameInfoTable[lynq_level], buf);//lt add @2021.7.22 for write outbuf
+        __android_log_print(ANDROID_LOG_INFO,log_name_arr, "%s",out_buf); //lt add @2021.9.22 for write syslog.log		
+    }
+    return ;
+#endif //LOG_ENABLE
+    return ;
+}
+
+/**
+ * @brief debug logs are printed and stored
+ * 
+ * @param log data
+ * @return void 
+ */
+void lynq_log_debug(const char *format,...)
+{
+#if LOG_ENABLE
+
+    char out_buf[LOG_OUT_LEN] = {0};    
+    char buf[LOG_LEN] = {0};
+    log_level_enum lynq_level = LOG_DEBUG;
+
+    if(lynq_level >=  LOG_LEVEL_MAX)
+        return;
+    if((log_level >> lynq_level)&0x00000001)
+    {	
+        va_list args;
+        //TagName
+        if(log_name_arr[0]  > 0)
+        {
+            printf("[%s]",log_name_arr);
+        }
+
+        //LevelName
+        printf("%s:",LogLevelNameInfoTable[lynq_level]); //lt dele @2021.7.22 for []
+
+        va_start(args,format);
+        vprintf(format,args);
+        vsnprintf(buf, sizeof(buf), format, args);  //lt add @2021.7.22 for write buf
+        va_end(args);
+        printf("\r\n");
+
+        sprintf(out_buf, "%s %s",LogLevelNameInfoTable[lynq_level], buf);//lt add @2021.7.22 for write outbuf
+        __android_log_print(ANDROID_LOG_DEBUG,log_name_arr, "%s",out_buf); //lt add @2021.9.22 for write syslog.log		
+    }
+    return ;
+#endif //LOG_ENABLE
+    return ;
+}
+
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-log/log-riltel/log.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-log/log-riltel/log.cpp
deleted file mode 100755
index 5feff58..0000000
--- a/cap/zx297520v3/src/lynq/lib/liblynq-log/log-riltel/log.cpp
+++ /dev/null
@@ -1,497 +0,0 @@
-#include "lynq_deflog.h"
-#include <stdarg.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <pthread.h>
-#include <log/log.h>
-#include <include/lynq_uci.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-
-#ifdef MOBILETEK_TARGET_PLATFORM_T106
-extern "C" {
-#include <cfg_api.h>
-}
-#endif
-
-// log entry for each module
-struct log_module_entry
-{
-    LYNQ_WRITE_LOG_PTR log_ptr; // function ptr of write log
-    log_level_enum level; // current log level of module;
-    char module_name[32]; // log tag
-    log_level_enum special_level; // defined by uci of [main module tag]__[module_tag]
-    log_level_enum exe_level; // defined by uci of [main module tag]
-    log_level_enum lib_level; // defined by uci of [module tag]
-    log_level_enum global_level; // defined by uci of "global_level"
-
-    log_module_entry() // constuctor of struct
-    {
-        level = LOG_INFO; // default log level when no uci value
-        special_level = LOG_LEVEL_MAX;
-        lib_level = LOG_LEVEL_MAX;
-        exe_level = LOG_LEVEL_MAX;
-        global_level = LOG_LEVEL_MAX;
-    }
-
-    void calc_level() // to calc the current log level
-    {
-        level = LOG_INFO;
-        if (special_level != LOG_LEVEL_MAX) // [exe]_[lib] level as the first consideration
-        {
-            level = special_level;
-        }
-        else if (exe_level != LOG_LEVEL_MAX) // when [exe] level is set
-        {
-            level = exe_level;
-        }
-        else if (lib_level != LOG_LEVEL_MAX) // when [lib] level is set
-        {
-            level = lib_level;
-        }
-        else if (global_level != LOG_LEVEL_MAX) // global log level is set
-        {
-            level = global_level;
-        }
-    }
-};
-
-
-static pthread_mutex_t s_lynq_log_mutex = PTHREAD_MUTEX_INITIALIZER; //lock for module entry array
-const int entry_count = 32; // max count of modules
-static int s_curr_reg_count = 0; // current reg modules count
-static int s_log_module_array_init_flag = 0;
-static struct log_module_entry *s_log_module_entries[entry_count] = {0};
-static volatile int s_main_module_entry_index = -1;
-
-#define LOG_UCI_MODULE "lynq_log"
-#define LOG_UCI_FILE "lynq_uci"
-
-template <int n>
-void lynq_write_log_func(log_level_enum level, const char *format, ...)
-{
-    log_module_entry *log_entry;
-    va_list args;
-    va_start(args,format);
-
-    log_entry = s_log_module_entries[n];
-    if (log_entry == NULL || level > log_entry->level)
-        return;
-
-    switch(level)
-    {
-        case LOG_VERBOSE:
-            __android_log_vprint(ANDROID_LOG_VERBOSE,log_entry->module_name, format, args);
-            break;
-        case LOG_ERROR:
-            __android_log_vprint(ANDROID_LOG_ERROR,log_entry->module_name, format, args);
-            break;
-        case LOG_WARNING:
-            __android_log_vprint(ANDROID_LOG_WARN,log_entry->module_name, format, args);
-            break;
-        case LOG_INFO:
-            __android_log_vprint(ANDROID_LOG_INFO,log_entry->module_name, format, args);
-            break;
-        case LOG_DEBUG:
-            __android_log_vprint(ANDROID_LOG_DEBUG,log_entry->module_name, format, args);
-            break;
-        default :
-            __android_log_print(ANDROID_LOG_DEBUG,log_entry->module_name, "Log Level is Error!!!!!!");
-            break;
-    }
-    va_end(args);
-    //return 0;
-}
-
-template <int n>
-void reg_write_log_function()
-{
-    s_log_module_entries[n] = new struct log_module_entry;
-    s_log_module_entries[n]->log_ptr = &lynq_write_log_func<n>;
-    reg_write_log_function<n-1>();
-}
-
-template <>
-void reg_write_log_function<0>()
-{
-    s_log_module_entries[0] = new struct log_module_entry;
-    s_log_module_entries[0]->log_ptr = &lynq_write_log_func<0>;
-}
-
-const static char * LogLevelNameInfoTable[LOG_LEVEL_MAX] =
-{
-    "[VERBOSE]","[ERROR]","[WARNING]","[INFO]","[DEBUG]"
-};
-
-static log_level_enum convert_log_level_from_string(const char * level_string)
-{
-    for(int level=LOG_VERBOSE; level < LOG_LEVEL_MAX; level++)
-    {
-        if (strcmp(LogLevelNameInfoTable[level], level_string) == 0)
-        {
-            return (log_level_enum)level;
-        }
-    }
-    return LOG_LEVEL_MAX;
-}
-
-static log_level_enum get_uci_log_value(const char *key)
-{
-    char level_buf[64] = {0};
-    if (key == NULL || key[0] == '\0')
-    {
-        return LOG_LEVEL_MAX;
-    }
-
-    if (0 == lynq_get_value((char*)LOG_UCI_FILE, (char*)LOG_UCI_MODULE, (char*)key, level_buf))
-    {
-        return convert_log_level_from_string(level_buf);
-    }
-
-    return LOG_LEVEL_MAX;
-}
-
-static void get_module_log_level(struct log_module_entry *entry) // calc module log level from uci
-{
-    int main_module_flag = 0;
-    char uci_key[64] = {0};
-
-    pthread_mutex_lock(&s_lynq_log_mutex);
-    if (s_main_module_entry_index >= 0) //to check if this entry is main module if main module is set
-    {
-        strcpy(uci_key, s_log_module_entries[s_main_module_entry_index]->module_name);
-        if (s_log_module_entries[s_main_module_entry_index] == entry)
-        {
-            main_module_flag = 1;
-        }
-    }
-    pthread_mutex_unlock(&s_lynq_log_mutex);
-
-    entry->global_level = get_uci_log_value("global_level");
-    entry->exe_level = get_uci_log_value(uci_key);
-    if (main_module_flag == 1) // if this entry is main module no need to get the special level
-    {
-        entry->lib_level = LOG_LEVEL_MAX;
-        entry->special_level = LOG_LEVEL_MAX;
-    }
-    else
-    {
-        entry->lib_level = get_uci_log_value(entry->module_name);
-        strcat(uci_key, "__");
-        strcat(uci_key, entry->module_name);
-        entry->special_level = get_uci_log_value(uci_key);
-    }
-    entry->calc_level();
-}
-
-static LYNQ_WRITE_LOG_PTR inner_log_function_init(const char *log_name, int main_module_flag)
-{
-    struct log_module_entry *entry = NULL;
-    if(log_name == NULL)
-    {
-        log_name = "MAIN";
-    }
-    pthread_mutex_lock(&s_lynq_log_mutex);
-    if (s_log_module_array_init_flag == 0) // to init module array if is not init
-    {
-        reg_write_log_function<entry_count-1>();
-        s_log_module_array_init_flag = 1;
-    }
-
-    if (s_curr_reg_count < entry_count) // if module entry is not use out
-    {
-        entry = s_log_module_entries[s_curr_reg_count];
-        if (main_module_flag == 1) // set s_main_module_entry_index when main module call
-        {
-            s_main_module_entry_index = s_curr_reg_count;
-        }
-        s_curr_reg_count++;
-
-        entry->level = LOG_DEBUG;
-        strncpy(entry->module_name, log_name, sizeof(entry->module_name));
-    }
-    pthread_mutex_unlock(&s_lynq_log_mutex);
-
-    if (entry == NULL)
-    {
-        return NULL;
-    }
-
-    get_module_log_level(entry); // init the log level
-
-    return entry->log_ptr;
-}
-
-/**
- * @brief lynq_log_function_init , this function called by lib
- * @param log_name
- * @return
- */
-LYNQ_WRITE_LOG_PTR lynq_log_function_init(const char *log_name)
-{
-    return inner_log_function_init(log_name, 0);
-}
-
-/**
- * @brief lynq_log_configuration_init , this function called by main module
- * @param log_name
- */
-void lynq_log_configuration_init(const char *log_name)
-{
-    log_level_enum exe_level;
-    char exe_key[64] = {0};
-    char special_key[64] = {0};
-
-    pthread_mutex_lock(&s_lynq_log_mutex);
-    for(int i=0; i < s_curr_reg_count; i++) // to check if log module is registered, bring it to main module
-    {
-        if (strcmp(log_name, s_log_module_entries[i]->module_name) == 0)
-        {
-            s_main_module_entry_index = i;
-            break;
-        }
-    }
-    pthread_mutex_unlock(&s_lynq_log_mutex);
-
-    if (s_main_module_entry_index == -1) // if not registered yet, init a main module entry
-    {
-        inner_log_function_init(log_name, 1);
-    }
-
-    pthread_mutex_lock(&s_lynq_log_mutex);
-    strcpy(exe_key, s_log_module_entries[s_main_module_entry_index]->module_name);
-    exe_level = get_uci_log_value(exe_key);
-    for(int i=0; i < s_curr_reg_count; i++) //recalc the module level when main module is set
-    {
-        s_log_module_entries[i]->exe_level = exe_level; // set the main module level
-        if (i == s_main_module_entry_index)
-            continue;
-
-        sprintf(special_key, "%s__%s", exe_key, s_log_module_entries[i]->module_name);
-        s_log_module_entries[i]->special_level = get_uci_log_value(special_key); // get the special level again
-        s_log_module_entries[i]->calc_level();
-    }
-    pthread_mutex_unlock(&s_lynq_log_mutex);
-}
-
-void lynq_log_global_output(log_level_enum level,const char *format,...)
-{
-    if (s_main_module_entry_index == -1)
-        return;
-
-    va_list args;
-    va_start(args,format);
-    s_log_module_entries[s_main_module_entry_index]->log_ptr(level, format, args);
-    va_end(args);
-}
-
-const char* lynq_read_log_version()
-{
-    return "LOG-V1.0";
-}
-
-#ifdef MOBILETEK_TARGET_PLATFORM_T106
-/**
- * @brief Set the syslog file size
- *
- * @param syslog file size (M)
- * @return 0:success other:fail
- */
-int lynq_syslog_set_file_size(int value)
-{
-    char lynq_syslog_data[64] = {0};
-
-    if(value > 100)
-    {
-        value = 100;
-    }
-    snprintf(lynq_syslog_data,sizeof(lynq_syslog_data),"%d",value);//Converts bytes to M
-    if (0 != sc_cfg_set("syslog_file_size", lynq_syslog_data))
-    {
-        return -1;
-    }
-    return sc_cfg_save();
-}
-
-/**
- * @brief Get the syslog file size
- *
- * @param log data
- * @return 1-100:success -1:fial
- */
-int lynq_syslog_get_file_size(void)
-{
-    int lynq_syslog_size = 0;
-    char lynq_syslog_data[64] = {0};
-    if(0 == sc_cfg_get("syslog_file_size", lynq_syslog_data, 64))
-    {
-        lynq_syslog_size = atoi(lynq_syslog_data);
-        return lynq_syslog_size;
-    }
-    return -1;
-}
-
-/**
- * @brief Set the syslog file rotate
- *
- * @param syslog file rotate number
- *
- * @return 0:success other:fial
- */
-int lynq_syslog_set_file_rotate(int value)
-{
-    char lynq_syslog_data[64] = {0};
-
-    if(value < 0)
-    {
-        value = 0;
-    }
-    else if(value > 99)
-    {
-        value = 99;
-    }
-
-    snprintf(lynq_syslog_data,sizeof(lynq_syslog_data),"%d",value);
-    if (0 != sc_cfg_set("syslog_file_num", lynq_syslog_data))
-    {
-        return -1;
-    }
-    return sc_cfg_save();
-}
-
-/**
- * @brief Example Set the number of syslog files cut
- *
- * @param log data
- * @return 0-99:success -1:fial
- */
-int lynq_syslog_get_file_rotate(void)
-{
-    int lynq_syslog_rotate = 0;
-    char lynq_syslog_data[64] = {0};
-    if(0 == sc_cfg_get("syslog_file_num", lynq_syslog_data, 64))
-    {
-        lynq_syslog_rotate = atoi(lynq_syslog_data);
-        return lynq_syslog_rotate;
-    }
-    return -1;
-}
-
-#else
-/**
- * @brief Set the syslog file size
- *
- * @param syslog file size (M)
- * @return 0:success other:fial
- */
-int lynq_syslog_set_file_size(int value)
-{
-    char lynq_syslog_data[64] = {0};
-
-    if(value <10)
-    {
-      value = 10;
-    }
-    else if(value > 1024)
-    {
-        value = 1024;
-    }
-    snprintf(lynq_syslog_data,sizeof(lynq_syslog_data),"%d",(value*1024*1024));//Converts bytes to M
-    return lynq_set_value(LOG_UCI_MODULE,"syslog_flie_size", lynq_syslog_data);
-}
-
-/**
- * @brief Get the syslog file size
- *
- * @param log data
- * @return 10-1024:success -1:fial
- */
-int lynq_syslog_get_file_size(void)
-{
-    int lynq_syslog_size = 0;
-    char lynq_syslog_data[64] = {0};
-    if(0 == lynq_get_value(LOG_UCI_FILE, LOG_UCI_MODULE, "syslog_flie_size", lynq_syslog_data))
-    {
-        lynq_syslog_size = ((atoi(lynq_syslog_data)) / 1024) /1024;
-        return lynq_syslog_size;
-    }
-    return -1;
-}
-
-/**
- * @brief Set the syslog file rotate
- *
- * @param syslog file rotate number
- *
- * @return 0:success other:fial
- */
-int lynq_syslog_set_file_rotate(int value)
-{
-    char lynq_syslog_data[64] = {0};
-
-    if(value < 0)
-    {
-        value = 0;
-    }
-    else if(value > 100)
-    {
-        value = 100;
-    }
-
-    snprintf(lynq_syslog_data,sizeof(lynq_syslog_data),"%d",value);
-    return lynq_set_value(LOG_UCI_MODULE, "syslog_flie_rotate", lynq_syslog_data);
-}
-
-/**
- * @brief Example Set the number of syslog files cut
- *
- * @param log data
- * @return 10-1024:success -1:fial
- */
-int lynq_syslog_get_file_rotate(void)
-{
-    int lynq_syslog_rotate = 0;
-    char lynq_syslog_data[64] = {0};
-    if(0 == lynq_get_value(LOG_UCI_FILE, LOG_UCI_MODULE, "syslog_flie_rotate", lynq_syslog_data))
-    {
-        lynq_syslog_rotate = atoi(lynq_syslog_data);
-        return lynq_syslog_rotate;
-    }
-    return -1;
-}
-#endif
-
-
-static void log_signal_handler(int signum) {
-    if (SIGUSR1 != signum)
-        return;
-    // 处理信号
-    for(int i=0; i < s_curr_reg_count; i++)
-    {
-        get_module_log_level(s_log_module_entries[i]);
-    }
-}
-
-void __attribute__((constructor)) lynq_log_init()
-{
-
-    pid_t pid;
-    char cmd_buf[64];
-    if (SIG_ERR != signal(SIGUSR1, log_signal_handler))
-    {
-        pid = getpid();
-        sprintf(cmd_buf, "mkdir -p /tmp/log_level/%d", pid);
-        system(cmd_buf);
-    }
-
-    pthread_mutex_lock(&s_lynq_log_mutex);
-    if (s_log_module_array_init_flag == 0)
-    {
-        reg_write_log_function<entry_count-1>();
-        s_log_module_array_init_flag = 1;
-    }
-    pthread_mutex_unlock(&s_lynq_log_mutex);
-}
-
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-log/log-riltel/makefile b/cap/zx297520v3/src/lynq/lib/liblynq-log/log-riltel/makefile
index 94fb918..ee97243 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-log/log-riltel/makefile
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-log/log-riltel/makefile
@@ -2,7 +2,6 @@
 RM = rm -f
 
 LOCAL_CFLAGS := -Wall \
-                -std=c++11 \
                 -g -Os \
                 -flto \
                 -fPIC \
@@ -18,26 +17,21 @@
 LOCAL_C_INCLUDES = \
   -I. \
   -I$(LOCAL_PATH)/../include/liblog \
+  -I$(ROOT)$(includedir) \
  -I$(ROOT)$(includedir)/logger \
 
 
 LOCAL_LIBS := \
     -L. \
     -ldl \
-    -std=c++11 \
     -llynq-uci \
     -llog \
 
-ifeq ($(strip $(TARGET_PLATFORM)), T106)
-LOCAL_CFLAGS += -DMOBILETEK_TARGET_PLATFORM_T106
-LOCAL_LIBS += -lnvram
-endif
-
-SOURCES = $(wildcard *.cpp wildcard *.h)
+SOURCES = $(wildcard *.c wildcard *.h)
 
 EXECUTABLE = liblynq-log.so
 
-OBJECTS=$(SOURCES:.cpp=.o)
+OBJECTS=$(SOURCES:.c=.o)
 
 
 .PHONY: build clean install pack_rootfs 
@@ -47,10 +41,7 @@
 	$(CXX) -shared -Wl,--no-undefined $(OBJECTS) $(LOCAL_LIBS) $(CFLAGS) $(LOCAL_CFLAGS) $(LOCAL_C_INCLUDES) -o $@
 
 %.o : %.c
-	$(CXX) $(LOCAL_C_INCLUDES) $(CFLAGS) $(LOCAL_CFLAGS) $(LOCAL_LIBS) -o $@ -c $< 
-
-%.o : %.cpp
-	$(CXX) $(LOCAL_C_INCLUDES) $(CFLAGS) $(LOCAL_CFLAGS) $(LOCAL_LIBS) -o $@ -c $< 
+	$(CC) $(LOCAL_C_INCLUDES) $(CFLAGS) $(LOCAL_CFLAGS) $(LOCAL_LIBS) -o $@ -c $< 
 
 build:  $(EXECUTABLE)
 	$(warning ########## build $(EXECUTABLE)  ##########)
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp
index 116503e..bba641e 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp
@@ -1549,8 +1549,5 @@
     return ret;      

  

 }

-

-DEFINE_LYNQ_LIB_LOG(LYNQ_NETWORK)

-

 #endif

 

diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
index 6a79c6c..c716522 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
@@ -1173,6 +1173,3 @@
     }
     return ret;
 }
-
-DEFINE_LYNQ_LIB_LOG(LYNQ_QSER_DATA)
-
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-fota/lynq-qser-fota.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-fota/lynq-qser-fota.cpp
index 8be66f8..e0dcafd 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-fota/lynq-qser-fota.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-fota/lynq-qser-fota.cpp
@@ -809,7 +809,6 @@
     return 0;

 }

 

-DEFINE_LYNQ_LIB_LOG(LYNQ_FOTA)

 

 #ifdef __cplusplus

 }

diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/lynq_qser_network.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/lynq_qser_network.cpp
index 0a32515..ec4097c 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/lynq_qser_network.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/lynq_qser_network.cpp
@@ -550,6 +550,3 @@
    
     return RESULT_OK;
 }
-
-DEFINE_LYNQ_LIB_LOG(LYNQ_QSER_NETWORK)
-
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-sim/lynq_qser_sim.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-sim/lynq_qser_sim.cpp
index d95945d..29b14e2 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-sim/lynq_qser_sim.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-sim/lynq_qser_sim.cpp
@@ -207,7 +207,4 @@
     ret = lynq_get_sim_status((int*)&pt_info->e_card_state);
     LYINFLOG("[%s-%d] QSER_CARD_STATUS: %d\n", __FUNCTION__, __LINE__, (int *)pt_info->e_card_state);
     return ret;
-}
-
-DEFINE_LYNQ_LIB_LOG(LYNQ_QSER_SIM)
-
+}
\ No newline at end of file
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-voice/lynq-qser-voice.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-voice/lynq-qser-voice.cpp
index b7c3d7a..1799ea1 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-voice/lynq-qser-voice.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-voice/lynq-qser-voice.cpp
@@ -208,7 +208,4 @@
         return RESULT_ERROR;
     }
     return lynq_switch_waiting_or_holding_and_active();
-}
-
-DEFINE_LYNQ_LIB_LOG(LYNQ_QSER_CALL)
-
+}
\ No newline at end of file
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-sms/lynq_sms.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-sms/lynq_sms.cpp
index 9d5ef30..f0b2bbd 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-sms/lynq_sms.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-sms/lynq_sms.cpp
@@ -364,5 +364,3 @@
     }

 }

 

-DEFINE_LYNQ_LIB_LOG(LYNQ_SMS)

-

diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-systime/lynq_systime.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-systime/lynq_systime.cpp
index 4109b21..8eaba2a 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-systime/lynq_systime.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-systime/lynq_systime.cpp
@@ -374,7 +374,6 @@
     return ret;

 }

 

-DEFINE_LYNQ_LIB_LOG(LYNQ_SYSTIME)

 #ifdef __cplusplus

 }

 #endif

diff --git a/cap/zx297520v3/src/lynq/lib/libpoweralarm/libpoweralarm.cpp b/cap/zx297520v3/src/lynq/lib/libpoweralarm/libpoweralarm.cpp
index 3d17411..5aeb496 100755
--- a/cap/zx297520v3/src/lynq/lib/libpoweralarm/libpoweralarm.cpp
+++ b/cap/zx297520v3/src/lynq/lib/libpoweralarm/libpoweralarm.cpp
@@ -350,7 +350,6 @@
 

 }

 

-DEFINE_LYNQ_LIB_LOG(LYNQ_POWERALARM)

 

 #ifdef __cplusplus

 }