Commit 764ec5a2 authored by Laurent THOMAS's avatar Laurent THOMAS

improve log header

parent 792b6b4e
......@@ -65,7 +65,7 @@ function start_basic_sim_enb {
echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/ran_build/" >> $1
echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1
echo "cd /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1
echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor --basicsim\" > ./my-lte-softmodem-run.sh " >> $1
echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor,line --basicsim\" > ./my-lte-softmodem-run.sh " >> $1
echo "chmod 775 ./my-lte-softmodem-run.sh" >> $1
echo "cat ./my-lte-softmodem-run.sh" >> $1
echo "if [ -e /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ]; then sudo sudo rm -f /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE; fi" >> $1
......@@ -110,7 +110,7 @@ function start_basic_sim_ue {
echo "echo \"cd /home/ubuntu/tmp/cmake_targets/ran_build/build/\"" > $1
echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1
echo "cd /home/ubuntu/tmp/cmake_targets/ran_build/build" >> $1
echo "echo \"./lte-uesoftmodem -C ${LOC_FREQUENCY}000000 -r $LOC_NB_RBS --log_config.global_log_options nocolor,level --basicsim\" > ./my-lte-uesoftmodem-run.sh" >> $1
echo "echo \"./lte-uesoftmodem -C ${LOC_FREQUENCY}000000 -r $LOC_NB_RBS --log_config.global_log_options nocolor,line,level --basicsim\" > ./my-lte-uesoftmodem-run.sh" >> $1
echo "chmod 775 ./my-lte-uesoftmodem-run.sh" >> $1
echo "cat ./my-lte-uesoftmodem-run.sh" >> $1
echo "if [ -e /home/ubuntu/tmp/cmake_targets/log/$LOC_UE_LOG_FILE ]; then sudo sudo rm -f /home/ubuntu/tmp/cmake_targets/log/$LOC_UE_LOG_FILE; fi" >> $1
......@@ -818,9 +818,9 @@ function start_l2_sim_enb {
echo "cd /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1
if [ $LOC_S1_CONFIGURATION -eq 0 ]
then
echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor --noS1\" > ./my-lte-softmodem-run.sh " >> $1
echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor,line --noS1\" > ./my-lte-softmodem-run.sh " >> $1
else
echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor \" > ./my-lte-softmodem-run.sh " >> $1
echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor,line \" > ./my-lte-softmodem-run.sh " >> $1
fi
echo "chmod 775 ./my-lte-softmodem-run.sh" >> $1
echo "cat ./my-lte-softmodem-run.sh" >> $1
......@@ -929,9 +929,9 @@ function start_l2_sim_ue {
echo "cd /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1
if [ $LOC_S1_CONFIGURATION -eq 0 ]
then
echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --L2-emul 3 --num-ues $LOC_NB_UES --nums_ue_thread 1 --nokrnmod 1 --log_config.global_log_options level,nocolor --noS1\" > ./my-lte-softmodem-run.sh " >> $1
echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --L2-emul 3 --num-ues $LOC_NB_UES --nums_ue_thread 1 --nokrnmod 1 --log_config.global_log_options level,nocolor,line --noS1\" > ./my-lte-softmodem-run.sh " >> $1
else
echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --L2-emul 3 --num-ues $LOC_NB_UES --nums_ue_thread 1 --nokrnmod 1 --log_config.global_log_options level,nocolor\" > ./my-lte-softmodem-run.sh " >> $1
echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --L2-emul 3 --num-ues $LOC_NB_UES --nums_ue_thread 1 --nokrnmod 1 --log_config.global_log_options level,nocolor,line\" > ./my-lte-softmodem-run.sh " >> $1
fi
echo "chmod 775 ./my-lte-softmodem-run.sh" >> $1
echo "cat ./my-lte-softmodem-run.sh" >> $1
......@@ -1051,9 +1051,9 @@ function start_rf_sim_enb {
echo "cd /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1
if [ $LOC_S1_CONFIGURATION -eq 0 ]
then
echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --rfsim --log_config.global_log_options level,nocolor --noS1 --eNBs.[0].rrc_inactivity_threshold 0\" > ./my-lte-softmodem-run.sh " >> $1
echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --rfsim --log_config.global_log_options level,nocolor,line --noS1 --eNBs.[0].rrc_inactivity_threshold 0\" > ./my-lte-softmodem-run.sh " >> $1
else
echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --rfsim --log_config.global_log_options level,nocolor --eNBs.[0].rrc_inactivity_threshold 0 --eNBs.[0].plmn_list.[0].mnc 93\" > ./my-lte-softmodem-run.sh " >> $1
echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --rfsim --log_config.global_log_options level,nocolor,line --eNBs.[0].rrc_inactivity_threshold 0 --eNBs.[0].plmn_list.[0].mnc 93\" > ./my-lte-softmodem-run.sh " >> $1
fi
echo "chmod 775 ./my-lte-softmodem-run.sh" >> $1
echo "cat ./my-lte-softmodem-run.sh" >> $1
......@@ -1159,9 +1159,9 @@ function start_rf_sim_ue {
echo "cd /home/ubuntu/tmp/cmake_targets/ran_build/build/" >> $1
if [ $LOC_S1_CONFIGURATION -eq 0 ]
then
echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -C ${LOC_FREQUENCY}000000 -r $LOC_PRB --ue-rxgain 140 --ue-txgain 120 --nokrnmod 1 --rfsim --log_config.global_log_options level,nocolor --noS1\" > ./my-lte-softmodem-run.sh " >> $1
echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -C ${LOC_FREQUENCY}000000 -r $LOC_PRB --ue-rxgain 140 --ue-txgain 120 --nokrnmod 1 --rfsim --log_config.global_log_options level,nocolor,line --noS1\" > ./my-lte-softmodem-run.sh " >> $1
else
echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -C ${LOC_FREQUENCY}000000 -r $LOC_PRB --ue-rxgain 140 --ue-txgain 120 --nokrnmod 1 --rfsim --log_config.global_log_options level,nocolor\" > ./my-lte-softmodem-run.sh " >> $1
echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -C ${LOC_FREQUENCY}000000 -r $LOC_PRB --ue-rxgain 140 --ue-txgain 120 --nokrnmod 1 --rfsim --log_config.global_log_options level,nocolor,line\" > ./my-lte-softmodem-run.sh " >> $1
fi
echo "chmod 775 ./my-lte-softmodem-run.sh" >> $1
echo "cat ./my-lte-softmodem-run.sh" >> $1
......@@ -1281,12 +1281,12 @@ function start_rf_sim_gnb {
then
if [ $LOC_RA_SA_TEST -eq 0 ] #no RA test => use --phy-test option
then
echo "echo \"./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor --parallel-config PARALLEL_SINGLE_THREAD --noS1 --nokrnmod 1 --rfsim --phy-test --lowmem --noS1\" > ./my-nr-softmodem-run.sh " >> $1
echo "echo \"./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor,line --parallel-config PARALLEL_SINGLE_THREAD --noS1 --nokrnmod 1 --rfsim --phy-test --lowmem --noS1\" > ./my-nr-softmodem-run.sh " >> $1
elif [ $LOC_RA_SA_TEST -eq 1 ] #RA test => use --do-ra option
then
echo "echo \"./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor --parallel-config PARALLEL_SINGLE_THREAD --rfsim --do-ra --lowmem --noS1\" > ./my-nr-softmodem-run.sh " >> $1
echo "echo \"./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor,line --parallel-config PARALLEL_SINGLE_THREAD --rfsim --do-ra --lowmem --noS1\" > ./my-nr-softmodem-run.sh " >> $1
else #SA test => use --sa option
echo "echo \"./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor --parallel-config PARALLEL_SINGLE_THREAD --rfsim --sa --lowmem \" > ./my-nr-softmodem-run.sh " >> $1
echo "echo \"./nr-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE --log_config.global_log_options level,nocolor,line --parallel-config PARALLEL_SINGLE_THREAD --rfsim --sa --lowmem \" > ./my-nr-softmodem-run.sh " >> $1
fi
fi
echo "chmod 775 ./my-nr-softmodem-run.sh" >> $1
......@@ -1397,12 +1397,12 @@ function start_rf_sim_nr_ue {
then
if [ $LOC_RA_SA_TEST -eq 0 ] #no RA test => use --phy-test option
then
echo "echo \"./nr-uesoftmodem --nokrnmod 1 --rfsim --phy-test --rrc_config_path /home/ubuntu/tmp/cmake_targets/ran_build/build/ --log_config.global_log_options level,nocolor --noS1\" > ./my-nr-softmodem-run.sh " >> $1
echo "echo \"./nr-uesoftmodem --nokrnmod 1 --rfsim --phy-test --rrc_config_path /home/ubuntu/tmp/cmake_targets/ran_build/build/ --log_config.global_log_options level,nocolor,line --noS1\" > ./my-nr-softmodem-run.sh " >> $1
elif [ $LOC_RA_SA_TEST -eq 1 ] #RA test => use --do-ra option
then
echo "echo \"./nr-uesoftmodem --rfsim --do-ra --log_config.global_log_options level,nocolor --rrc_config_path /home/ubuntu/tmp/cmake_targets/ran_build/build/\" > ./my-nr-softmodem-run.sh " >> $1
echo "echo \"./nr-uesoftmodem --rfsim --do-ra --log_config.global_log_options level,nocolor,line --rrc_config_path /home/ubuntu/tmp/cmake_targets/ran_build/build/\" > ./my-nr-softmodem-run.sh " >> $1
else #SA test => use --sa option
echo "echo \"./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --sa --log_config.global_log_options level,nocolor\" > ./my-nr-softmodem-run.sh " >> $1
echo "echo \"./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --sa --log_config.global_log_options level,nocolor,line\" > ./my-nr-softmodem-run.sh " >> $1
fi
fi
echo "chmod 775 ./my-nr-softmodem-run.sh" >> $1
......
......@@ -194,6 +194,11 @@ configmodule_interface_t *load_configmodule(int argc,
int i;
int OoptIdx=-1;
printf("CMDLINE: ");
for (int i=0; i<argc; i++)
printf("\"%s\" ", argv[i]);
printf("\n");
/* first parse the command line to look for the -O option */
for (i = 0; i<argc; i++) {
if (strlen(argv[i]) < 2)
......
......@@ -9,7 +9,7 @@ All logging facility parameters are defined in the log_config section. Some para
|:---:|:---:|:---:|:----|
| `global_log_level` | `pre-defined string of char` | `info` | Allows printing of messages up to the specified level. Available levels, from lower to higher are `error`,`warn`,`info`,`debug`,`trace` |
| `global_log_online` | `boolean` | 1 (=true) | If false, all console messages are discarded, whatever their level |
| `global_log_options` | `list of pre-defined string of char` | | 3 options can be specified to trigger the information added in the header of the message: `nocolor`, disable color usage in log messages, usefull when redirecting logs to a file, where escape sequences used for color selection can be annoying, `level`, add a one letter level id in the message header (T,D,I,W,E for trace, debug, info, warning, error),`thread`, add the thread name in the message header|
| `global_log_options` | `list of pre-defined string of char` | | 3 options can be specified to trigger the information added in the header of the message: `nocolor`, disable color usage in log messages, usefull when redirecting logs to a file, where escape sequences used for color selection can be annoying, `level`, add a one letter level id in the message header (T,D,I,W,E for trace, debug, info, warning, error),`thread`, add the thread name in the message header, `function`, adds the function name, `line`, adds the line number, `time` adds the time since process starts|
### Component specific parameters
| name | type | default | description |
......
......@@ -73,7 +73,9 @@ mapping log_options[] = {
{"nocolor", FLAG_NOCOLOR },
{"level", FLAG_LEVEL },
{"thread", FLAG_THREAD },
{NULL,-1}
{"line", FLAG_FILE_LINE },
{"function", FLAG_FUNCT},
{"time", FLAG_TIME}
};
......@@ -81,6 +83,7 @@ mapping log_maskmap[] = LOG_MASKMAP_INIT;
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 */
static void log_output_memory(log_component_t *c, const char *file, const char *func, int line, int comp, int level, const char* format,va_list args);
int write_file_matlab(const char *fname,
......@@ -495,84 +498,95 @@ int logInit (void)
return 0;
}
char *log_getthreadname(char *threadname,
int bufsize)
static inline int log_header(log_component_t *c,
char *log_buffer,
int buffsize,
const char *file,
const char *func,
int line,
int level)
{
int rt = pthread_getname_np(pthread_self(), threadname,bufsize) ;
if (rt == 0) {
return threadname;
int flag= g_log->flag | c->flag;
char threadname[64];
if (flag & FLAG_THREAD ) {
threadname[0]='{';
if ( pthread_getname_np(pthread_self(), threadname+1,61) != 0)
strcpy(threadname+1, "?thread?");
strcat(threadname,"}");
} else {
threadname[0]=0;
}
char l[32];
if (flag & FLAG_FILE_LINE && flag & FLAG_FUNCT )
snprintf(l, sizeof l," (%s:%d) ", func, line);
else if (flag & FLAG_FILE_LINE)
sprintf(l," (%d) ", line);
else
l[0]=0;
char timeString[32];
if ( flag & FLAG_TIME ) {
struct timespec t;
clock_gettime(CLOCK_MONOTONIC, &t);
static double tOrigin=0;
if (tOrigin==0)
tOrigin=t.tv_sec+t.tv_nsec/1.0e9;
snprintf(timeString, sizeof t,"%05.3f",t.tv_sec+t.tv_nsec/1.0e9-tOrigin);
} else {
return "thread?";
timeString[0]=0;
}
}
static int log_header(char *log_buffer,
int buffsize,
int comp,
int level,
const char *format)
{
char threadname[PR_SET_NAME];
return snprintf(log_buffer, buffsize, "%s%s[%s]%c %s %s%s",
log_level_highlight_end[level],
( (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,PR_SET_NAME+1):""),
format,
log_level_highlight_end[level]);
return snprintf(log_buffer, buffsize, "%s%s[%s]%c%s %s ",
timeString,
flag & FLAG_NOCOLOR ? "" : log_level_highlight_start[level],
c->name,
flag & FLAG_LEVEL ? g_log->level2string[level] : ' ',
l,
threadname
);
}
void logRecord_mt(const char *file,
const char *func,
int line,
int comp,
int level,
const char *format,
... )
const char *func,
int line,
int comp,
int level,
const char *format,
... )
{
char log_buffer[MAX_LOG_TOTAL]= {0};
log_component_t *c = &g_log->log_component[comp];
va_list args;
va_start(args,format);
if (log_mem_flag == 1) {
log_output_memory(file,func,line,comp,level,format,args);
} else {
log_header(log_buffer,MAX_LOG_TOTAL,comp,level,format);
g_log->log_component[comp].vprint(g_log->log_component[comp].stream,log_buffer,args);
fflush(g_log->log_component[comp].stream);
}
log_output_memory(c, file,func,line,comp,level,format,args);
va_end(args);
}
void vlogRecord_mt(const char *file,
const char *func,
int line,
int comp,
int level,
const char *format,
va_list args )
const char *func,
int line,
int comp,
int level,
const char *format,
va_list args )
{
char log_buffer[MAX_LOG_TOTAL];
if (log_mem_flag == 1) {
log_output_memory(file,func,line,comp,level, format,args);
} else {
log_header(log_buffer,MAX_LOG_TOTAL,comp, level,format);
g_log->log_component[comp].vprint(g_log->log_component[comp].stream,log_buffer, args);
}
log_component_t *c = &g_log->log_component[comp];
log_output_memory(c, file,func,line,comp,level, format,args);
}
void log_dump(int component,
void *buffer,
int buffsize,
int datatype,
const char *format,
... )
void *buffer,
int buffsize,
int datatype,
const char *format,
... )
{
va_list args;
char *wbuf;
log_component_t *c = &g_log->log_component[component];
int flag= g_log->flag | c->flag;
switch(datatype) {
case LOG_DUMP_DOUBLE:
wbuf=malloc((buffsize * 10) + 64 + MAX_LOG_TOTAL);
......@@ -586,9 +600,8 @@ void log_dump(int component,
if (wbuf != NULL) {
va_start(args, format);
int pos=log_header(wbuf,MAX_LOG_TOTAL,component, OAILOG_INFO,"");
int pos2=vsprintf(wbuf+pos,format, args);
pos=pos+pos2;
int pos=log_header(c, wbuf,MAX_LOG_TOTAL,"noFile","noFunc",0, OAILOG_INFO);
pos+=vsprintf(wbuf+pos,format, args);
va_end(args);
for (int i=0; i<buffsize; i++) {
......@@ -603,9 +616,11 @@ void log_dump(int component,
break;
}
}
sprintf(wbuf+pos,"\n");
g_log->log_component[component].print(g_log->log_component[component].stream,wbuf);
if ( flag & FLAG_NOCOLOR )
sprintf(wbuf+pos,"\n");
else
sprintf(wbuf+pos,"%s\n",log_level_highlight_end[OAILOG_INFO]);
c->print(c->stream,wbuf);
free(wbuf);
}
}
......@@ -805,13 +820,10 @@ void flush_mem_to_file(void)
char logmem_log_level[NUM_LOG_LEVEL]={'E','W','I','D','T'};
void log_output_memory(const char *file, const char *func, int line, int comp, int level, const char* format,va_list args)
static void log_output_memory(log_component_t *c, const char *file, const char *func, int line, int comp, int level, const char* format,va_list args)
{
//logRecord_mt(file,func,line, pthread_self(), comp, level, format, ##args)
int len = 0;
log_component_t *c;
char *log_start;
char *log_end;
/* The main difference with the version above is the use of this local log_buffer.
* The other difference is the return value of snprintf which was not used
* correctly. It was not a big problem because in practice MAX_LOG_TOTAL is
......@@ -819,92 +831,17 @@ void log_output_memory(const char *file, const char *func, int line, int comp, i
*/
char log_buffer[MAX_LOG_TOTAL];
/* for no gcc warnings */
(void)log_start;
(void)log_end;
c = &g_log->log_component[comp];
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_LOG_RECORD, VCD_FUNCTION_IN);
// make sure that for log trace the extra info is only printed once, reset when the level changes
if (level == OAILOG_TRACE) {
log_start = log_buffer;
len = vsnprintf(log_buffer, MAX_LOG_TOTAL, format, args);
if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
log_end = log_buffer + len;
} else {
if ( (g_log->flag & 0x001) || (c->flag & 0x001) ) {
len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "%s",
log_level_highlight_start[level]);
if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
}
log_start = log_buffer + len;
// if ( (g_log->flag & 0x004) || (c->flag & 0x004) ) {
len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s]",
g_log->log_component[comp].name);
if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
// }
if ( (level >= OAILOG_ERR) && (level <= OAILOG_TRACE) ) {
len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%c]",
logmem_log_level[level]);
if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
}
if ( (g_log->flag & FLAG_THREAD) || (c->flag & FLAG_THREAD) ) {
# define THREAD_NAME_LEN 128
char threadname[THREAD_NAME_LEN];
if (pthread_getname_np(pthread_self(), threadname, THREAD_NAME_LEN) != 0)
{
perror("pthread_getname_np : ");
} else {
len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s]", threadname);
if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
}
# undef THREAD_NAME_LEN
}
if ( (g_log->flag & FLAG_FUNCT) || (c->flag & FLAG_FUNCT) ) {
len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s] ",
func);
if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
}
if ( (g_log->flag & FLAG_FILE_LINE) || (c->flag & FLAG_FILE_LINE) ) {
len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%s:%d]",
file, line);
if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
}
/* len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%08lx]", thread_id);
if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
struct timeval gettime;
gettimeofday(&gettime,NULL);
len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "[%ld.%06ld]", gettime.tv_sec, gettime.tv_usec);
if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
*/
if ( (g_log->flag & FLAG_NOCOLOR) || (c->flag & FLAG_NOCOLOR) ) {
len += snprintf(&log_buffer[len], MAX_LOG_TOTAL - len, "%s",
log_level_highlight_end[level]);
if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
}
len += vsnprintf(&log_buffer[len], MAX_LOG_TOTAL - len, format, args);
if (len > MAX_LOG_TOTAL) len = MAX_LOG_TOTAL;
log_end = log_buffer + len;
}
//va_end(args);
if (level < OAILOG_TRACE)
len += log_header(c, log_buffer, MAX_LOG_TOTAL, file, func, line, level);
len += vsnprintf(log_buffer+len, MAX_LOG_TOTAL-len, format, args);
if ( !((g_log->flag | c->flag) & FLAG_NOCOLOR) )
len+=snprintf(log_buffer+len, MAX_LOG_TOTAL-len, "%s", log_level_highlight_end[level]);
// OAI printf compatibility
if(log_mem_flag==1){
if(log_mem_d[log_mem_side].enable_flag==1){
int temp_index;
if(log_mem_flag==1){
if(log_mem_d[log_mem_side].enable_flag==1){
int temp_index;
temp_index=log_mem_d[log_mem_side].buf_index;
if(temp_index+len+1 < LOG_MEM_SIZE){
log_mem_d[log_mem_side].buf_index+=len;
......@@ -935,9 +872,9 @@ void log_output_memory(const char *file, const char *func, int line, int comp, i
}
}
}
}else{
fwrite(log_buffer, len, 1, stdout);
}
}else{
fwrite(log_buffer, len, 1, c->stream);
}
}
int logInit_log_mem (void)
......
......@@ -317,7 +317,6 @@ int register_log_component(char *name, char *fext, int compidx);
#define LOG_MEM_SIZE 100*1024*1024
#define LOG_MEM_FILE "./logmem.log"
void flush_mem_to_file(void);
void log_output_memory(const char *file, const char *func, int line, int comp, int level, const char* format,va_list args);
int logInit_log_mem(void);
void close_log_mem(void);
......
......@@ -62,11 +62,6 @@
#include "executables/softmodem-common.h"
extern RAN_CONTEXT_t RC;
extern int
gtpv1u_delete_s1u_tunnel(
const instance_t instanceP,
const gtpv1u_enb_delete_tunnel_req_t *const req_pP);
/* Value to indicate an invalid UE initial id */
static const uint16_t UE_INITIAL_ID_INVALID = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment