Commit 79588a49 authored by frtabu's avatar frtabu
Browse files

LOG_F replaced by LOG_DUMPMSG. Add a generic function to dump a buffer or...

LOG_F replaced by LOG_DUMPMSG. Add a generic function to dump a buffer or message. Go on with LOG_M implementation improvement. Remove redundant options to enable/disable logs.
parent e469680d
......@@ -54,7 +54,6 @@
mapping log_level_names[] = {
{"error", OAILOG_ERR},
{"file", OAILOG_FILE},
{"warn", OAILOG_WARNING},
{"info", OAILOG_INFO},
{"debug", OAILOG_DEBUG},
......@@ -70,18 +69,10 @@ mapping log_options[] = {
};
mapping log_maskmap[] = {
{"prach", DEBUG_PRACH},
{"RU", DEBUG_RU},
{"LTEESTIM", DEBUG_LTEESTIM},
{"ctrlsocket", DEBUG_CTRLSOCKET},
{"UE_PHYPROC", DEBUG_UE_PHYPROC},
{"UE_TIMING", UE_TIMING},
{NULL,-1}
};
mapping log_maskmap[] = LOG_MASKMAP_INIT;
char *log_level_highlight_start[] = {LOG_RED, LOG_GREEN, LOG_ORANGE, "", LOG_BLUE, LOG_CYBL}; /*!< \brief Optional start-format strings for highlighting */
char *log_level_highlight_end[] = {LOG_RESET,LOG_RESET,LOG_RESET,LOG_RESET, LOG_RESET,LOG_RESET}; /*!< \brief Optional end-format strings for highlighting */
char *log_level_highlight_start[] = {LOG_RED, LOG_ORANGE, "", LOG_BLUE, LOG_CYBL}; /*!< \brief Optional start-format strings for highlighting */
char *log_level_highlight_end[] = {LOG_RESET,LOG_RESET,LOG_RESET, LOG_RESET,LOG_RESET}; /*!< \brief Optional end-format strings for highlighting */
int write_file_matlab(const char *fname,const char *vname,void *data,int length,int dec,char format)
......@@ -243,6 +234,7 @@ int write_file_matlab(const char *fname,const char *vname,void *data,int length,
/* get log parameters from configuration file */
void log_getconfig(log_t *g_log) {
char *gloglevel = NULL;
int consolelog ;
int level;
......@@ -250,7 +242,7 @@ void log_getconfig(log_t *g_log) {
paramdef_t logparams_level[MAX_LOG_PREDEF_COMPONENTS];
paramdef_t logparams_logfile[MAX_LOG_PREDEF_COMPONENTS];
paramdef_t logparams_debug[sizeof(log_maskmap)/sizeof(mapping)];
paramdef_t logparams_matlab[sizeof(log_maskmap)/sizeof(mapping)];
paramdef_t logparams_genfile[sizeof(log_maskmap)/sizeof(mapping)];
int ret = config_get( logparams_defaults,sizeof(logparams_defaults)/sizeof(paramdef_t),CONFIG_STRING_LOG_PREFIX);
if (ret <0) {
......@@ -258,6 +250,7 @@ void log_getconfig(log_t *g_log) {
return;
}
/* set LOG display options (enable/disable color, thread name, level ) */
for(int i=0; i<logparams_defaults[LOG_OPTIONS_IDX].numelt ; i++) {
for(int j=0; log_options[j].name != NULL ; j++) {
if (strcmp(logparams_defaults[LOG_OPTIONS_IDX].strlistptr[i],log_options[j].name) == 0) {
......@@ -304,37 +297,39 @@ void log_getconfig(log_t *g_log) {
/* now set the log levels and infile option, according to what we read */
for (int i=MIN_LOG_COMPONENTS; i < MAX_LOG_PREDEF_COMPONENTS; i++) {
level = map_str_to_int(log_level_names, *(logparams_level[i].strptr));
set_log(i, level,1);
set_log(i, level);
if (*(logparams_logfile[i].uptr) == 1)
set_component_filelog(i);
}
/* build then read the debug and matlab parameter array */
/* build then read the debug and genfile parameter array */
for (int i=0;log_maskmap[i].name != NULL ; i++) {
sprintf(logparams_debug[i].optname, LOG_CONFIG_DEBUG_FORMAT, log_maskmap[i].name);
sprintf(logparams_matlab[i].optname, LOG_CONFIG_MATLAB_FORMAT, log_maskmap[i].name);
sprintf(logparams_genfile[i].optname, LOG_CONFIG_GENFILE_FORMAT, log_maskmap[i].name);
logparams_debug[i].defuintval = 0;
logparams_debug[i].type = TYPE_UINT;
logparams_debug[i].paramflags = PARAMFLAG_BOOL;
logparams_debug[i].uptr = NULL;
logparams_debug[i].chkPptr = NULL;
logparams_debug[i].numelt = 0;
logparams_matlab[i].defuintval = 0;
logparams_matlab[i].type = TYPE_UINT;
logparams_matlab[i].paramflags = PARAMFLAG_BOOL;
logparams_matlab[i].uptr = NULL;
logparams_matlab[i].chkPptr = NULL;
logparams_matlab[i].numelt = 0;
logparams_genfile[i].defuintval = 0;
logparams_genfile[i].type = TYPE_UINT;
logparams_genfile[i].paramflags = PARAMFLAG_BOOL;
logparams_genfile[i].uptr = NULL;
logparams_genfile[i].chkPptr = NULL;
logparams_genfile[i].numelt = 0;
}
config_get( logparams_debug,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX);
config_get( logparams_matlab,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX);
config_get( logparams_genfile,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX);
/* set the debug mask according to the debug parameters values */
for (int i=0; log_maskmap[i].name != NULL ; i++) {
if (*(logparams_debug[i].uptr) )
g_log->debug_mask = g_log->debug_mask | log_maskmap[i].value;
if (*(logparams_matlab[i].uptr) )
g_log->matlab_mask = g_log->matlab_mask | log_maskmap[i].value;
if (*(logparams_genfile[i].uptr) )
g_log->genfile_mask = g_log->genfile_mask | log_maskmap[i].value;
}
/* log globally enabled/disabled */
set_glog_onlinelog(consolelog);
}
int register_log_component(char *name, char *fext, int compidx)
......@@ -354,9 +349,8 @@ int computed_compidx=compidx;
}
if (computed_compidx >= 0 && computed_compidx <MAX_LOG_COMPONENTS) {
g_log->log_component[computed_compidx].name = strdup(name);
g_log->log_component[computed_compidx].level = LOG_ERR;
g_log->log_component[computed_compidx].interval = 1;
g_log->log_component[computed_compidx].stream = NULL;
g_log->log_component[computed_compidx].savedlevel = LOG_ERR;
g_log->log_component[computed_compidx].stream = stdout;
g_log->log_component[computed_compidx].filelog = 0;
g_log->log_component[computed_compidx].filelog_name = malloc(strlen(name)+16);/* /tmp/<name>.%s rounded to ^2 */
sprintf(g_log->log_component[computed_compidx].filelog_name,"/tmp/%s.%s",name,fext);
......@@ -432,12 +426,9 @@ int logInit (void)
g_log->level2string[OAILOG_WARNING] = "W"; // WARNING
g_log->level2string[OAILOG_INFO] = "I"; //INFO
g_log->level2string[OAILOG_DEBUG] = "D"; // DEBUG
g_log->level2string[OAILOG_FILE] = "F"; // file
// g_log->level2string[OAILOG_FILE] = "F"; // file
g_log->level2string[OAILOG_TRACE] = "T"; // TRACE
g_log->onlinelog = 1; //online log file
g_log->filelog = 0;
......@@ -446,19 +437,6 @@ int logInit (void)
log_getconfig(g_log);
// could put a loop here to check for all comps
for (i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
if (g_log->log_component[i].filelog == 1 ) {
g_log->log_component[i].stream = fopen(g_log->log_component[i].filelog_name,"w");
g_log->log_component[i].fwrite = vfprintf;
} else if (g_log->log_component[i].filelog == 1 ) {
g_log->log_component[i].stream = fopen(g_log->filelog_name,"w");
g_log->log_component[i].fwrite = vfprintf;
} else if (g_log->onlinelog == 1 ) {
g_log->log_component[i].stream = stdout;
g_log->log_component[i].fwrite = vfprintf;
}
}
// set all unused component items to 0, they are for non predefined components
for (i=MAX_LOG_PREDEF_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
......@@ -470,8 +448,6 @@ int logInit (void)
}
char *log_getthreadname(char *threadname, int bufsize) {
int rt = pthread_getname_np(pthread_self(), threadname,bufsize) ;
......@@ -506,27 +482,58 @@ void logRecord_mt(const char *file, const char *func, int line, int comp, int le
( (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);
g_log->log_component[comp].vprint(g_log->log_component[comp].stream,log_buffer, args);
va_end(args);
}
void log_dump(int component, void *buffer, int buffsize,int datatype, const char* format, ... ) {
va_list args;
char *wbuf;
switch(datatype) {
case LOG_DUMP_DOUBLE:
wbuf=malloc((buffsize * 10) + 64 );
break;
case LOG_DUMP_CHAR:
default:
wbuf=malloc((buffsize * 3 ) + 64 );
break;
}
va_start(args, format);
g_log->log_component[component].vprint(g_log->log_component[component].stream,format, args);
va_end(args);
if (wbuf != NULL) {
int pos=0;
for (int i=0; i<buffsize; i++) {
switch(datatype) {
case LOG_DUMP_DOUBLE:
pos = pos + sprintf(wbuf+pos,"%04.4lf ", (double)((double *)buffer)[i]);
break;
case LOG_DUMP_CHAR:
default:
pos = pos + sprintf(wbuf+pos,"%02x ", (unsigned char)((unsigned char *)buffer)[i]);
break;
}
}
sprintf(wbuf+pos,"\n");
g_log->log_component[component].print(g_log->log_component[component].stream,wbuf);
free(wbuf);
}
}
int set_log(int component, int level, int interval)
int set_log(int component, int level)
{
/* Checking parameters */
DevCheck((component >= MIN_LOG_COMPONENTS) && (component < MAX_LOG_COMPONENTS),
component, MIN_LOG_COMPONENTS, MAX_LOG_COMPONENTS);
DevCheck((level < NUM_LOG_LEVEL) && (level >= OAILOG_ERR), level, NUM_LOG_LEVEL,
OAILOG_ERR);
DevCheck((interval >= 0) && (interval <= 0xFF), interval, 0, 0xFF);
g_log->log_component[component].level = level;
g_log->log_component[component].interval = interval;
g_log->log_component[component].level = level;
g_log->log_component[component].savedlevel = level;
return 0;
}
......@@ -536,32 +543,67 @@ int set_log(int component, int level, int interval)
void set_glog(int level)
{
for (int c=0; c< MAX_LOG_COMPONENTS; c++ ) {
g_log->log_component[c].level = level;
set_log(c, level);
}
}
void set_glog_onlinelog(int enable)
{
g_log->onlinelog = enable;
for (int c=0; c< MAX_LOG_COMPONENTS; c++ ) {
if ( enable ) {
g_log->log_component[c].level = g_log->log_component[c].savedlevel;
g_log->log_component[c].vprint = vfprintf;
g_log->log_component[c].print = fprintf;
g_log->log_component[c].stream = stdout;
} else {
g_log->log_component[c].level = -1;
}
}
}
void set_glog_filelog(int enable)
{
g_log->filelog = enable;
static FILE *fptr;
if ( enable ) {
fptr = fopen(g_log->filelog_name,"w");
for (int c=0; c< MAX_LOG_COMPONENTS; c++ ) {
close_component_filelog(c);
g_log->log_component[c].stream = fptr;
g_log->log_component[c].filelog = 1;
}
} else {
for (int c=0; c< MAX_LOG_COMPONENTS; c++ ) {
g_log->log_component[c].filelog = 0;
if (fptr != NULL) {
fclose(fptr);
}
g_log->log_component[c].stream = stdout;
}
}
}
void set_component_filelog(int comp)
{
if (g_log->log_component[comp].filelog == 0) {
g_log->log_component[comp].filelog = 1;
if (g_log->log_component[comp].stream == NULL) {
if (g_log->log_component[comp].stream == NULL || g_log->log_component[comp].stream == stdout) {
g_log->log_component[comp].stream = fopen(g_log->log_component[comp].filelog_name,"w");
}
}
g_log->log_component[comp].vprint = vfprintf;
g_log->log_component[comp].print = fprintf;
g_log->log_component[comp].filelog = 1;
}
void close_component_filelog(int comp)
{
g_log->log_component[comp].filelog = 0;
if (g_log->log_component[comp].stream != NULL && g_log->log_component[comp].stream != stdout ) {
fclose(g_log->log_component[comp].stream);
g_log->log_component[comp].stream = stdout;
}
g_log->log_component[comp].vprint = vfprintf;
g_log->log_component[comp].print = fprintf;
}
/*
* for the two functions below, the passed array must have a final entry
......@@ -616,15 +658,13 @@ int is_newline( char *str, int size)
void logClean (void)
{
int i;
LOG_I(PHY,"\n");
LOG_UI(PHY,"\n");
for (i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
if (g_log->log_component[i].stream != NULL) {
fclose(g_log->log_component[i].stream);
}
close_component_filelog(i);
}
}
......@@ -650,8 +690,8 @@ int test_log(void)
LOG_D(MAC, "1 debug MAC \n");
LOG_W(MAC, "1 warning MAC \n");
set_log(EMU, OAILOG_INFO, FLAG_ONLINE);
set_log(MAC, OAILOG_WARNING, 0);
set_log(EMU, OAILOG_INFO);
set_log(MAC, OAILOG_WARNING);
LOG_I(EMU, "2 Starting OAI logs version %s Build date: %s on %s\n",
BUILD_VERSION, BUILD_DATE, BUILD_HOST);
......@@ -661,7 +701,7 @@ int test_log(void)
LOG_I(MAC, "2 info MAC \n");
set_log(MAC, OAILOG_NOTICE, 1);
set_log(MAC, OAILOG_NOTICE);
LOG_ENTER(MAC);
LOG_I(EMU, "3 Starting OAI logs version %s Build date: %s on %s\n",
......@@ -670,8 +710,8 @@ int test_log(void)
LOG_W(MAC, "3 warning MAC \n");
LOG_I(MAC, "3 info MAC \n");
set_log(MAC, LOG_DEBUG,1);
set_log(EMU, LOG_DEBUG,1);
set_log(MAC, LOG_DEBUG);
set_log(EMU, LOG_DEBUG);
LOG_ENTER(MAC);
LOG_I(EMU, "4 Starting OAI logs version %s Build date: %s on %s\n",
......@@ -681,8 +721,8 @@ int test_log(void)
LOG_I(MAC, "4 info MAC \n");
set_log(MAC, LOG_DEBUG,0);
set_log(EMU, LOG_DEBUG,0);
set_log(MAC, LOG_DEBUG);
set_log(EMU, LOG_DEBUG);
LOG_I(LOG, "5 Starting OAI logs version %s Build date: %s on %s\n",
BUILD_VERSION, BUILD_DATE, BUILD_HOST);
......@@ -691,8 +731,8 @@ int test_log(void)
LOG_I(MAC, "5 info MAC \n");
set_log(MAC, LOG_TRACE,0X07F);
set_log(EMU, LOG_TRACE,0X07F);
set_log(MAC, LOG_TRACE);
set_log(EMU, LOG_TRACE);
LOG_ENTER(MAC);
LOG_I(LOG, "6 Starting OAI logs version %s Build date: %s on %s\n",
......
......@@ -83,11 +83,10 @@ extern "C" {
* @{*/
# define OAILOG_ERR 0 /*!< \brief critical error conditions, impact on "must have" fuctinalities */
# define OAILOG_FILE 1 /*!< \brief important informational messages, but everything OK */
# define OAILOG_WARNING 2 /*!< \brief warning conditions, shouldn't happen but doesn't impact "must have" functionalities */
# define OAILOG_INFO 3 /*!< \brief informational messages most people don't need, shouldn't impact real-time behavior */
# define OAILOG_DEBUG 4 /*!< \brief first level debug-level messages, for developers , may impact real-time behavior */
# define OAILOG_TRACE 5 /*!< \brief second level debug-level messages, for developers ,likely impact real-time behavior*/
# define OAILOG_WARNING 1 /*!< \brief warning conditions, shouldn't happen but doesn't impact "must have" functionalities */
# define OAILOG_INFO 2 /*!< \brief informational messages most people don't need, shouldn't impact real-time behavior */
# define OAILOG_DEBUG 3 /*!< \brief first level debug-level messages, for developers , may impact real-time behavior */
# define OAILOG_TRACE 4 /*!< \brief second level debug-level messages, for developers ,likely impact real-time behavior*/
#define NUM_LOG_LEVEL 6 /*!< \brief the number of message levels users have with LOG */
/* @}*/
......@@ -128,21 +127,47 @@ extern "C" {
/** @defgroup macros to identify a debug entity
* @ingroup each macro is a bit mask where the unique bit set identifies an entity to be debugged
* it allows to dynamically activate or not blocks of code
* it allows to dynamically activate or not blocks of code. The LOG_MASKMAP_INIT macro
* is used to map a character string name to each debug bit, it allows to set or clear
* the corresponding bit via the defined name, from the configuration or from the telnet
* server.
* @brief
* @{*/
#define DEBUG_PRACH (1<<0)
#define DEBUG_RU (1<<1)
#define DEBUG_UE_PHYPROC (1<<2)
#define DEBUG_LTEESTIM (1<<3)
#define DEBUG_DLCELLSPEC (1<<4)
#define DEBUG_ULSCH (1<<5)
#define DEBUG_RRC (1<<6)
#define DEBUG_PDCP (1<<7)
#define DEBUG_DFT (1<<8)
#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))
#define SET_LOG_MATLAB(O) g_log->matlab_mask = (g_log->matlab_mask | O)
#define CLEAR_LOG_MATLAB(O) g_log->matlab_mask = (g_log->matlab_mask & (~O))
#define LOG_MASKMAP_INIT {\
{"PRACH", DEBUG_PRACH},\
{"RU", DEBUG_RU},\
{"LTEESTIM", DEBUG_LTEESTIM},\
{"CTRLSOCKET", DEBUG_CTRLSOCKET},\
{"UE_PHYPROC", DEBUG_UE_PHYPROC},\
{"DLCELLSPEC", DEBUG_DLCELLSPEC},\
{"ULSCH", DEBUG_ULSCH},\
{"RRC", DEBUG_RRC},\
{"PDCP", DEBUG_PDCP},\
{"DFT", DEBUG_DFT},\
{"UE_TIMING", UE_TIMING},\
{NULL,-1}\
}
#define SET_LOG_DEBUG(B) g_log->debug_mask = (g_log->debug_mask | B)
#define CLEAR_LOG_DEBUG(B) g_log->debug_mask = (g_log->debug_mask & (~B))
#define SET_LOG_DUMP(B) g_log->genfile_mask = (g_log->genfile_mask | B)
#define CLEAR_LOG_DUMP(B) g_log->genfile_mask = (g_log->genfile_mask & (~B))
......@@ -199,17 +224,18 @@ typedef struct {
int value; /*!< \brief integer value of mapping */
} mapping;
typedef int(*log_write_func_t)(FILE *stream, const char *format, va_list ap );
typedef int(*log_vprint_func_t)(FILE *stream, const char *format, va_list ap );
typedef int(*log_print_func_t)(FILE *stream, const char *format, ... );
typedef struct {
const char *name;
int level;
int flag;
int interval;
int filelog;
char *filelog_name;
FILE *stream;
log_write_func_t fwrite;
const char *name;
int level;
int savedlevel;
int flag;
int filelog;
char *filelog_name;
FILE *stream;
log_vprint_func_t vprint;
log_print_func_t print;
/* SR: make the log buffer component relative */
char log_buffer[MAX_LOG_TOTAL];
} log_component_t;
......@@ -218,12 +244,10 @@ typedef struct {
typedef struct {
log_component_t log_component[MAX_LOG_COMPONENTS];
char* level2string[NUM_LOG_LEVEL];
int onlinelog;
int flag;
int filelog;
char* filelog_name;
uint64_t debug_mask;
uint64_t matlab_mask;
uint64_t genfile_mask;
} log_t;
......@@ -254,14 +278,15 @@ extern log_t *g_log;
/*----------------------------------------------------------------------------*/
int logInit (void);
void logRecord_mt(const char *file, const char *func, int line,int comp, int level, const char *format, ...) __attribute__ ((format (printf, 6, 7)));
int set_log(int component, int level, int interval);
void log_dump(int component, void *buffer, int buffsize,int datatype, const char* format, ... );
int set_log(int component, int level);
void set_glog(int level);
void set_glog_onlinelog(int enable);
void set_glog_filelog(int enable);
void set_component_filelog(int comp);
void close_component_filelog(int comp);
void set_component_consolelog(int comp);
int map_str_to_int(mapping *map, const char *str);
char *map_int_to_str(mapping *map, int val);
void logClean (void);
......@@ -293,7 +318,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
#define LOG_CONFIG_LEVEL_FORMAT "%s_log_level"
#define LOG_CONFIG_LOGFILE_FORMAT "%s_log_infile"
#define LOG_CONFIG_DEBUG_FORMAT "%s_debug"
#define LOG_CONFIG_MATLAB_FORMAT "%s_matlab"
#define LOG_CONFIG_GENFILE_FORMAT "%s_genfile"
#define LOG_CONFIG_HELP_OPTIONS " list of comma separated options to enable log module behavior. Available options: \n"\
" nocolor: disable color usage in log messages\n"\
......@@ -309,7 +334,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
/*------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define LOG_GLOBALPARAMS_DESC { \
{LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL, "Default log level for all componemts\n", 0, strptr:(char **)&gloglevel, defstrval:log_level_names[2].name, TYPE_STRING, 0}, \
{LOG_CONFIG_STRING_GLOBAL_LOG_ONLINE, "Default console output option, for all components\n", 0, iptr:&(g_log->onlinelog), defintval:1, TYPE_INT, 0}, \
{LOG_CONFIG_STRING_GLOBAL_LOG_ONLINE, "Default console output option, for all components\n", 0, iptr:&(consolelog), defintval:1, TYPE_INT, 0}, \
{LOG_CONFIG_STRING_GLOBAL_LOG_OPTIONS, LOG_CONFIG_HELP_OPTIONS, 0, strlistptr:NULL, defstrlistval:NULL, TYPE_STRINGLIST,0} \
}
......@@ -319,23 +344,25 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
* @ingroup _macro
* @brief Macro used to call logIt function with different message levels
* @{*/
// debugging macros(g_log->log_component[component].interval?logRecord_mt(__FILE__, __FUNCTION__, __LINE__, component, level, format, ##args):(void)0)
#define LOG_DUMP_CHAR 0
#define LOG_DUMP_DOUBLE 1
// debugging macros
#define LOG_F LOG_I /* because LOG_F was originaly to dump a message or buffer but is also used as a regular level...., to dump use LOG_DUMPMSG */
# if T_TRACER
/* per component, level dependant macros */
# define LOG_I(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} else { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ;}} while (0)
# define LOG_W(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_WARNING) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_WARNING, x) ;} else { T(T_LEGACY_ ## c ## _WARNING, T_PRINTF(x)) ;}} while (0)
# define LOG_E(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_ERR ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ERR, x) ;} else { T(T_LEGACY_ ## c ## _ERROR, T_PRINTF(x)) ;}} while (0)
# define LOG_W(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_WARNING) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_WARNING, x) ;} else { T(T_LEGACY_ ## c ## _WARNING, T_PRINTF(x)) ;}} while (0)
# define LOG_I(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} else { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ;}} while (0)
# define LOG_D(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} else { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ;}} while (0)
# define LOG_T(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} else { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x)) ;}} while (0)
# define LOG_F(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_FILE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_FILE, x) ;}} while (0) /* */
/* macro used to dump a buffer or a message as in openair2/RRC/LTE/RRC_eNB.c, replaces LOG_F macro */
# define LOG_DUMPMSG(c, f, b, s, x...) do { if(g_log->genfile_mask & f) log_dump(c, b, s, LOG_DUMP_CHAR, x) ;} while (0) /* */
# define nfapi_log(FILE, FNC, LN, COMP, LVL, F...) do { if (T_stdout) { logRecord_mt(__FILE__, __FUNCTION__, __LINE__,COMP, LVL, F) ;}} while (0) /* */
/* bitmask dependant macros, to isolate debugging code */
# define LOG_DEBUG_BEGIN(D) if (g_log->debug_mask & D) {
# define LOG_DEBUG_END }
/* bitmask dependant macros, to generate matlab files */
# define LOG_M_BEGIN(D) if (g_log->matlab_mask & D) {
# define LOG_M_END }
# define LOG_DEBUGFLAG(D) (g_log->debug_mask & D)
/* bitmask dependant macros, to generate debug file such as matlab file or message dump */
# define LOG_GENFILEFLAG(D) (g_log->genfile_mask & D)
# 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
......@@ -345,12 +372,11 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
# define LOG_E(c, x...) /* */
# define LOG_D(c, x...) /* */
# define LOG_T(c, x...) /* */
# define LOG_F(c, x...) /* */
# define LOG_DUMPMSG(c, b, s, x...) /* */
# define nfapi_log(FILE, FNC, LN, COMP, LVL, FMT...)
# define LOG_DEBUG_BEGIN(D) if (0) {
# define LOG_DEBUG_END }
# define LOG_M_BEGIN(D) if (0) {
# define LOG_M_END }
# define LOG_DEBUGFLAG(D) ( 0 )
# define LOG_GENFILEFLAG(D) ( 0 )
# define LOG_M(file, vector, data, len, dec, format)
# define LOG_VAR(A,B)
# endif /* T_TRACER */
......@@ -359,8 +385,8 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
/* 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)
#define LOG_UDUMPMSG(c, b, s, f, x...) do { log_dump(c, b, s, f, x) ;} while (0) /* */
/* @}*/
......
......@@ -70,8 +70,8 @@ char *tmpstr;
char *shlibpath =NULL;
char *shlibversion=NULL;
char *cfgprefix;
paramdef_t LoaderParams[] ={{"shlibpath", NULL, 0, strptr:&shlibpath, defstrval:NULL, TYPE_STRING, 0},
{"shlibversion", NULL, 0, strptr:&shlibversion, defstrval:"", TYPE_STRING, 0}};
paramdef_t LoaderParams[] ={{"shlibpath", NULL, 0, strptr:&shlibpath, defstrval:NULL, TYPE_STRING, 0, NULL},
{"shlibversion", NULL, 0, strptr:&shlibversion, defstrval:"", TYPE_STRING, 0, NULL}};
int ret;
......
......@@ -72,13 +72,13 @@ typedef int(*getfarrayfunc_t)(loader_shlibfunc_t **funcarray);
#define DEFAULT_MAXSHLIBS 10
loader_data_t loader_data;
/*------------------------------------------------------------------------------------------------------------------------------------------------*/
/* LOADER parameters */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*------------------------------------------------------------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* LOADER parameters */
/* optname helpstr paramflags XXXptr defXXXval type numelt check func*/
/*----------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define LOADER_PARAMS_DESC { \
{"shlibpath", NULL, PARAMFLAG_NOFREE, strptr:(char **)&(loader_data.shlibpath), defstrval:DEFAULT_PATH, TYPE_STRING, 0}, \
{"maxshlibs", NULL, 0, uptr:&(loader_data.maxshlibs), defintval:DEFAULT_MAXSHLIBS, TYPE_UINT32, 0}, \
{"shlibpath", NULL, PARAMFLAG_NOFREE, strptr:(char **)&(loader_data.shlibpath), defstrval:DEFAULT_PATH, TYPE_STRING, 0, NULL},\
{"maxshlibs", NULL, 0, uptr:&(loader_data.maxshlibs), defintval:DEFAULT_MAXSHLIBS, TYPE_UINT32, 0, NULL}\
}
/*-------------------------------------------------------------------------------------------------------------*/
......
......@@ -199,28 +199,29 @@ int proccmd_show(char *buf, int debug, telnet_printfunc_t prnt)
print_threads(buf,debug,prnt);