[84929][85032][85034]fix syslog set/get log level, default file count and size
Change-Id: I56929b9b4a403c15650656fcaa8eab428e4d33bf
diff --git a/mbtk/include/lynq/lynq_deflog.h b/mbtk/include/lynq/lynq_deflog.h
index 3fecfc7..fd45185 100755
--- a/mbtk/include/lynq/lynq_deflog.h
+++ b/mbtk/include/lynq/lynq_deflog.h
@@ -18,42 +18,180 @@
#ifdef __cplusplus
}
#endif
+#define lynq_log_verbose(fmt, args...) \
+ do{ \
+ char *file_ptr_1001 = __FILE__; \
+ char *ptr_1001 = file_ptr_1001 + strlen(file_ptr_1001) - 1; \
+ char line_1001[10] = {0}; \
+ sprintf(line_1001, "%d", __LINE__); \
+ while(ptr_1001 >= file_ptr_1001 && *ptr_1001){ \
+ if(*ptr_1001 == '/') \
+ break; \
+ ptr_1001--; \
+ } \
+ mbtk_log(LOG_VERBOSE_LEVEL, "%s#%s: " fmt, ptr_1001 + 1, line_1001, ##args); \
+ } while(0)
-#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 lynq_log_error(fmt, args...) \
+ do{ \
+ char *file_ptr_1001 = __FILE__; \
+ char *ptr_1001 = file_ptr_1001 + strlen(file_ptr_1001) - 1; \
+ char line_1001[10] = {0}; \
+ sprintf(line_1001, "%d", __LINE__); \
+ while(ptr_1001 >= file_ptr_1001 && *ptr_1001){ \
+ if(*ptr_1001 == '/') \
+ break; \
+ ptr_1001--; \
+ } \
+ mbtk_log(LOG_ERR_LEVEL, "%s#%s: " fmt, ptr_1001 + 1, line_1001, ##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)
+#define lynq_log_warning(fmt, args...) \
+ do{ \
+ char *file_ptr_1001 = __FILE__; \
+ char *ptr_1001 = file_ptr_1001 + strlen(file_ptr_1001) - 1; \
+ char line_1001[10] = {0}; \
+ sprintf(line_1001, "%d", __LINE__); \
+ while(ptr_1001 >= file_ptr_1001 && *ptr_1001){ \
+ if(*ptr_1001 == '/') \
+ break; \
+ ptr_1001--; \
+ } \
+ mbtk_log(LOG_WARN_LEVEL, "%s#%s: " fmt, ptr_1001 + 1, line_1001, ##args); \
+ } while(0)
-// just for comcompatibility, do nothing
-#define LYLOGSET(a) do{;}while(0)
-#define LYLOGEINIT(Y) do{;}while(0)
+#define lynq_log_info(fmt, args...) \
+ do{ \
+ char *file_ptr_1001 = __FILE__; \
+ char *ptr_1001 = file_ptr_1001 + strlen(file_ptr_1001) - 1; \
+ char line_1001[10] = {0}; \
+ sprintf(line_1001, "%d", __LINE__); \
+ while(ptr_1001 >= file_ptr_1001 && *ptr_1001){ \
+ if(*ptr_1001 == '/') \
+ break; \
+ ptr_1001--; \
+ } \
+ mbtk_log(LOG_INFO_LEVEL, "%s#%s: " fmt, ptr_1001 + 1, line_1001, ##args); \
+ } while(0)
-#ifndef ALOGV
-#define ALOGV(...) do {lynq_write_log(LOG_VERBOSE,__VA_ARGS__);} while (0)
-#endif
+#define lynq_log_debug(fmt, args...) \
+ do{ \
+ char *file_ptr_1001 = __FILE__; \
+ char *ptr_1001 = file_ptr_1001 + strlen(file_ptr_1001) - 1; \
+ char line_1001[10] = {0}; \
+ sprintf(line_1001, "%d", __LINE__); \
+ while(ptr_1001 >= file_ptr_1001 && *ptr_1001){ \
+ if(*ptr_1001 == '/') \
+ break; \
+ ptr_1001--; \
+ } \
+ mbtk_log(LOG_DEBUG_LEVEL, "%s#%s: " fmt "\n", ptr_1001 + 1, line_1001, ##args); \
+ } while(0)
-#ifndef ALOGE
-#define ALOGE(...) do {lynq_write_log(LOG_ERROR,__VA_ARGS__);} while (0)
-#endif
+#define LYVERBLOG(fmt, args...) \
+ do{ \
+ char *file_ptr_1001 = __FILE__; \
+ char *ptr_1001 = file_ptr_1001 + strlen(file_ptr_1001) - 1; \
+ char line_1001[10] = {0}; \
+ sprintf(line_1001, "%d", __LINE__); \
+ while(ptr_1001 >= file_ptr_1001 && *ptr_1001){ \
+ if(*ptr_1001 == '/') \
+ break; \
+ ptr_1001--; \
+ } \
+ mbtk_log(LOG_VERBOSE_LEVEL, "%s#%s: " fmt, ptr_1001 + 1, line_1001, ##args); \
+ } while(0)
-#ifndef ALOGW
-#define ALOGW(...) do {lynq_write_log(LOG_WARNING,__VA_ARGS__);} while (0)
-#endif
+#define LYERRLOG(fmt, args...) \
+ do{ \
+ char *file_ptr_1001 = __FILE__; \
+ char *ptr_1001 = file_ptr_1001 + strlen(file_ptr_1001) - 1; \
+ char line_1001[10] = {0}; \
+ sprintf(line_1001, "%d", __LINE__); \
+ while(ptr_1001 >= file_ptr_1001 && *ptr_1001){ \
+ if(*ptr_1001 == '/') \
+ break; \
+ ptr_1001--; \
+ } \
+ mbtk_log(LOG_ERR_LEVEL, "%s#%s: " fmt, ptr_1001 + 1, line_1001, ##args); \
+ } while(0)
-#ifndef ALOGI
-#define ALOGI(...) do {lynq_write_log(LOG_INFO,__VA_ARGS__);} while (0)
-#endif
+#define LYWARNLOG(fmt, args...) \
+ do{ \
+ char *file_ptr_1001 = __FILE__; \
+ char *ptr_1001 = file_ptr_1001 + strlen(file_ptr_1001) - 1; \
+ char line_1001[10] = {0}; \
+ sprintf(line_1001, "%d", __LINE__); \
+ while(ptr_1001 >= file_ptr_1001 && *ptr_1001){ \
+ if(*ptr_1001 == '/') \
+ break; \
+ ptr_1001--; \
+ } \
+ mbtk_log(LOG_WARN_LEVEL, "%s#%s: " fmt, ptr_1001 + 1, line_1001, ##args); \
+ } while(0)
-#ifndef ALOGD
-#define ALOGD(...) do {lynq_write_log(LOG_DEBUG,__VA_ARGS__);} while (0)
-#endif
+#define LYINFLOG(fmt, args...) \
+ do{ \
+ char *file_ptr_1001 = __FILE__; \
+ char *ptr_1001 = file_ptr_1001 + strlen(file_ptr_1001) - 1; \
+ char line_1001[10] = {0}; \
+ sprintf(line_1001, "%d", __LINE__); \
+ while(ptr_1001 >= file_ptr_1001 && *ptr_1001){ \
+ if(*ptr_1001 == '/') \
+ break; \
+ ptr_1001--; \
+ } \
+ mbtk_log(LOG_INFO_LEVEL, "%s#%s: " fmt, ptr_1001 + 1, line_1001, ##args); \
+ } while(0)
+
+#define LYDBGLOG(fmt, args...) \
+ do{ \
+ char *file_ptr_1001 = __FILE__; \
+ char *ptr_1001 = file_ptr_1001 + strlen(file_ptr_1001) - 1; \
+ char line_1001[10] = {0}; \
+ sprintf(line_1001, "%d", __LINE__); \
+ while(ptr_1001 >= file_ptr_1001 && *ptr_1001){ \
+ if(*ptr_1001 == '/') \
+ break; \
+ ptr_1001--; \
+ } \
+ mbtk_log(LOG_DEBUG_LEVEL, "%s#%s: " fmt "\n", ptr_1001 + 1, line_1001, ##args); \
+ } while(0)
+// #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; \