gsm0710muxd-hack: LOGMUX macros: refactor
Have only one LOGMUX macro, which will write to the log file if -o is set.
This commit is contained in:
parent
38d40e08ff
commit
6ef21745e8
|
@ -99,17 +99,20 @@
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
#define LOGMUX(lvl, f, ...) do { \
|
||||||
|
if (lvl <= syslog_level) { \
|
||||||
|
if (logtofile) { \
|
||||||
|
fprintf(muxlogfile, "%d:%s(): " f "\n", __LINE__, __func__, ##__VA_ARGS__); \
|
||||||
|
fflush(muxlogfile); \
|
||||||
|
} else { \
|
||||||
|
fprintf(stderr, "%d:%s(): " f "\n", __LINE__, __func__, ##__VA_ARGS__); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#ifndef MUX_ANDROID
|
#ifndef MUX_ANDROID
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
//#define LOG(lvl, f, ...) do{if(lvl<=syslog_level)syslog(lvl,"%s:%d:%s(): " f "\n", __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__);}while(0)
|
//#define LOG(lvl, f, ...) do{if(lvl<=syslog_level)syslog(lvl,"%s:%d:%s(): " f "\n", __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__);}while(0)
|
||||||
#define LOGMUX(lvl,f,...) do{if(lvl<=syslog_level){\
|
|
||||||
if (logtofile){\
|
|
||||||
fprintf(muxlogfile,"%d:%s(): " f "\n", __LINE__, __FUNCTION__, ##__VA_ARGS__);\
|
|
||||||
fflush(muxlogfile);}\
|
|
||||||
else\
|
|
||||||
fprintf(stderr,"%d:%s(): " f "\n", __LINE__, __FUNCTION__, ##__VA_ARGS__);\
|
|
||||||
}\
|
|
||||||
}while(0)
|
|
||||||
#else //will enable logging using android logging framework (not to file)
|
#else //will enable logging using android logging framework (not to file)
|
||||||
|
|
||||||
#ifdef MTK_RIL_MD1
|
#ifdef MTK_RIL_MD1
|
||||||
|
@ -127,19 +130,6 @@
|
||||||
#define LOG_NOTICE 5
|
#define LOG_NOTICE 5
|
||||||
#define LOG_INFO 6
|
#define LOG_INFO 6
|
||||||
#define LOG_DEBUG 7
|
#define LOG_DEBUG 7
|
||||||
|
|
||||||
#ifdef MTK_RIL_MD1
|
|
||||||
#define LOGMUX(lvl,f,...) do{if(lvl<=syslog_level){\
|
|
||||||
fprintf(stderr, \
|
|
||||||
"[gsm0710muxd] %d:%s(): " f "\n", __LINE__, __FUNCTION__, ##__VA_ARGS__);}\
|
|
||||||
}while(0)
|
|
||||||
#else
|
|
||||||
#define LOGMUX(lvl,f,...) do{if(lvl<=syslog_level){\
|
|
||||||
fprintf(stderr, \
|
|
||||||
"[gsm0710muxdmd2] %d:%s(): " f "\n", __LINE__, __FUNCTION__, ##__VA_ARGS__);}\
|
|
||||||
}while(0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /*MUX_ANDROID*/
|
#endif /*MUX_ANDROID*/
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
Loading…
Reference in New Issue