remove compilation warnings, especially when disabling T_TRACER. enhance LOG_M macro implementation, introduce LOG_DEBUG_XXX macro to replace #ifdef DEBUG_XXX
This commit is contained in:
+16
-13
@@ -71,8 +71,11 @@ mapping log_options[] = {
|
||||
|
||||
|
||||
mapping log_maskmap[] = {
|
||||
{"prach", DEBUG_PRACH},
|
||||
{"RU", DEBUG_RU},
|
||||
{"prach", DEBUG_PRACH},
|
||||
{"RU", DEBUG_RU},
|
||||
{"ctrlsocket", DEBUG_CTRLSOCKET},
|
||||
{"UE_PHYPROC", DEBUG_UE_PHYPROC},
|
||||
{"UE_TIMING", UE_TIMING},
|
||||
{NULL,-1}
|
||||
};
|
||||
|
||||
@@ -377,7 +380,6 @@ int logInit (void)
|
||||
register_log_component("RLC","log",RLC);
|
||||
register_log_component("PDCP","log",PDCP);
|
||||
register_log_component("RRC","log",RRC);
|
||||
register_log_component("EMU","log",EMU);
|
||||
register_log_component("OMG","csv",OMG);
|
||||
register_log_component("OTG","log",OTG);
|
||||
register_log_component("OTG_LATENCY","dat",OTG_LATENCY);
|
||||
@@ -399,7 +401,7 @@ int logInit (void)
|
||||
register_log_component("FLEXRAN_AGENT","log",FLEXRAN_AGENT);
|
||||
register_log_component("TMR","",TMR);
|
||||
register_log_component("USIM","txt",USIM);
|
||||
|
||||
register_log_component("SIM","txt",SIM);
|
||||
|
||||
/* following log component are used for the localization*/
|
||||
register_log_component("LOCALIZE","log",LOCALIZE);
|
||||
@@ -465,14 +467,15 @@ int logInit (void)
|
||||
|
||||
|
||||
|
||||
char *log_getthreadname(char *threadname) {
|
||||
|
||||
if (pthread_getname_np(pthread_self(), threadname, sizeof(threadname)) != 0)
|
||||
{
|
||||
return "thread?";
|
||||
} else {
|
||||
return threadname;
|
||||
}
|
||||
char *log_getthreadname(char *threadname, int bufsize) {
|
||||
|
||||
int rt = pthread_getname_np(pthread_self(), threadname,bufsize) ;
|
||||
if (rt == 0)
|
||||
{
|
||||
return threadname;
|
||||
} else {
|
||||
return "thread?";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -495,7 +498,7 @@ void logRecord_mt(const char *file, const char *func, int line, int comp, int le
|
||||
( (g_log->flag & FLAG_NOCOLOR)?"":log_level_highlight_start[level]),
|
||||
g_log->log_component[comp].name,
|
||||
( (g_log->flag & FLAG_LEVEL)?g_log->level2string[level]:""),
|
||||
( (g_log->flag & FLAG_THREAD)?log_getthreadname(threadname):""),
|
||||
( (g_log->flag & FLAG_THREAD)?log_getthreadname(threadname,PR_SET_NAME+1):""),
|
||||
format);
|
||||
|
||||
g_log->log_component[comp].fwrite(g_log->log_component[comp].stream,log_buffer, args);
|
||||
|
||||
+13
-3
@@ -131,8 +131,11 @@ extern "C" {
|
||||
* it allows to dynamically activate or not blocks of code
|
||||
* @brief
|
||||
* @{*/
|
||||
#define DEBUG_PRACH (1<<0)
|
||||
#define DEBUG_RU (1<<1)
|
||||
#define DEBUG_PRACH (1<<0)
|
||||
#define DEBUG_RU (1<<1)
|
||||
#define DEBUG_UE_PHYPROC (1<<2)
|
||||
#define DEBUG_CTRLSOCKET (1<<10)
|
||||
#define UE_TIMING (1<<20)
|
||||
|
||||
#define SET_LOG_DEBUG(O) g_log->debug_mask = (g_log->debug_mask | O)
|
||||
#define CLEAR_LOG_DEBUG(O) g_log->debug_mask = (g_log->debug_mask & (~O))
|
||||
@@ -340,6 +343,8 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
|
||||
# define LOG_M_BEGIN(D) if (g_log->matlab_mask & D) {
|
||||
# define LOG_M_END }
|
||||
# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)/* */
|
||||
/* define variable only used in LOG macro's */
|
||||
# define LOG_VAR(A,B) A B
|
||||
# else /* T_TRACER: remove all debugging and tracing messages, except errors */
|
||||
# define LOG_I(c, x...) /* */
|
||||
# define LOG_W(c, x...) /* */
|
||||
@@ -353,10 +358,15 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
|
||||
# define LOG_M_BEGIN(D) if (0) {
|
||||
# define LOG_M_END }
|
||||
# define LOG_M(file, vector, data, len, dec, format)
|
||||
|
||||
# define LOG_VAR(A,B)
|
||||
# endif /* T_TRACER */
|
||||
/* avoid warnings for variables only used in LOG macro's but set outside debug section */
|
||||
#define LOG_USEDINLOG_VAR(A,B) __attribute__((unused)) A B
|
||||
|
||||
/* unfiltered macros, usefull for simulators or messages at init time, before log is configured */
|
||||
#define LOG_UM(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)
|
||||
|
||||
#define LOG_UI(c, x...) do {logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ; } while(0)
|
||||
/* @}*/
|
||||
|
||||
|
||||
|
||||
@@ -361,7 +361,7 @@ int s = sscanf(buf,"%ms %i-%i\n",&logsubcmd, &idx1,&idx2);
|
||||
int l;
|
||||
int optbit;
|
||||
|
||||
l=sscanf(logsubcmd,"%m[^'_']_%m[^'_']",&logparam,&opt);
|
||||
l=sscanf(logsubcmd,"%m[^'_']_%ms",&logparam,&opt);
|
||||
if (l == 2 && strcmp(logparam,"print") == 0){
|
||||
optbit=map_str_to_int(log_options,opt);
|
||||
if (optbit < 0) {
|
||||
|
||||
Reference in New Issue
Block a user