Commit 6a414418 authored by frtabu's avatar frtabu

fix L2simulator LOG problem

parent 1b083050
...@@ -385,7 +385,6 @@ int logInit (void) { ...@@ -385,7 +385,6 @@ int logInit (void) {
register_log_component("OCG","",OCG); register_log_component("OCG","",OCG);
register_log_component("PERF","",PERF); register_log_component("PERF","",PERF);
register_log_component("OIP","",OIP); register_log_component("OIP","",OIP);
register_log_component("CLI","",CLI);
register_log_component("MSC","log",MSC); register_log_component("MSC","log",MSC);
register_log_component("OCM","log",OCM); register_log_component("OCM","log",OCM);
register_log_component("HW","",HW); register_log_component("HW","",HW);
...@@ -408,6 +407,8 @@ int logInit (void) { ...@@ -408,6 +407,8 @@ int logInit (void) {
register_log_component("X2AP","",X2AP); register_log_component("X2AP","",X2AP);
register_log_component("LOADER","log",LOADER); register_log_component("LOADER","log",LOADER);
register_log_component("ASN","log",ASN); register_log_component("ASN","log",ASN);
register_log_component("NFAPI_PNF","log",NFAPI_PNF);
register_log_component("NFAPI_VNF","log",NFAPI_VNF);
for (int i=0 ; log_level_names[i].name != NULL ; i++) for (int i=0 ; log_level_names[i].name != NULL ; i++)
g_log->level2string[i] = toupper(log_level_names[i].name[0]); // uppercased first letter of level name g_log->level2string[i] = toupper(log_level_names[i].name[0]); // uppercased first letter of level name
...@@ -457,6 +458,12 @@ void logRecord_mt(const char *file, const char *func, int line, int comp, int le ...@@ -457,6 +458,12 @@ void logRecord_mt(const char *file, const char *func, int line, int comp, int le
va_end(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 ) {
char log_buffer[MAX_LOG_TOTAL];
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);
}
void log_dump(int component, void *buffer, int buffsize,int datatype, const char *format, ... ) { void log_dump(int component, void *buffer, int buffsize,int datatype, const char *format, ... ) {
va_list args; va_list args;
char *wbuf; char *wbuf;
......
...@@ -198,7 +198,6 @@ typedef enum { ...@@ -198,7 +198,6 @@ typedef enum {
NAS, NAS,
PERF, PERF,
OIP, OIP,
CLI,
MSC, MSC,
OCM, OCM,
UDP_, UDP_,
...@@ -218,6 +217,8 @@ typedef enum { ...@@ -218,6 +217,8 @@ typedef enum {
X2AP, X2AP,
LOADER, LOADER,
ASN, ASN,
NFAPI_VNF,
NFAPI_PNF,
MAX_LOG_PREDEF_COMPONENTS, MAX_LOG_PREDEF_COMPONENTS,
} }
comp_name_t; comp_name_t;
...@@ -286,6 +287,7 @@ extern "C" { ...@@ -286,6 +287,7 @@ extern "C" {
int logInit (void); int logInit (void);
int isLogInitDone (void); int isLogInitDone (void);
void logRecord_mt(const char *file, const char *func, int line,int comp, int level, const char *format, ...) __attribute__ ((format (printf, 6, 7))); void logRecord_mt(const char *file, const char *func, int line,int comp, int level, const char *format, ...) __attribute__ ((format (printf, 6, 7)));
void vlogRecord_mt(const char *file, const char *func, int line, int comp, int level, const char *format, va_list args );
void log_dump(int component, void *buffer, int buffsize,int datatype, const char *format, ... ); void log_dump(int component, void *buffer, int buffsize,int datatype, const char *format, ... );
int set_log(int component, int level); int set_log(int component, int level);
void set_glog(int level); void set_glog(int level);
...@@ -365,9 +367,9 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int ...@@ -365,9 +367,9 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
# 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_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_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_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 VLOG(c,l, f, args) do { if (T_stdout) { if( g_log->log_component[c].level >= l ) vlogRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, l, f, args) ;} } while (0)
/* macro used to dump a buffer or a message as in openair2/RRC/LTE/RRC_eNB.c, replaces LOG_F macro */ /* 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->dump_mask & f) log_dump(c, b, s, LOG_DUMP_CHAR, x) ;} while (0) /* */ # define LOG_DUMPMSG(c, f, b, s, x...) do { if(g_log->dump_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 */ /* bitmask dependant macros, to isolate debugging code */
# define LOG_DEBUGFLAG(D) (g_log->debug_mask & D) # define LOG_DEBUGFLAG(D) (g_log->debug_mask & D)
......
...@@ -800,6 +800,47 @@ ID = LEGACY_SIM_TRACE ...@@ -800,6 +800,47 @@ ID = LEGACY_SIM_TRACE
GROUP = ALL:LEGACY_SIM:LEGACY_GROUP_TRACE:LEGACY GROUP = ALL:LEGACY_SIM:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log FORMAT = string,log
ID = LEGACY_NFAPI_VNF_INFO
DESC = NFAPI_VNF legacy logs - info level
GROUP = ALL:LEGACY_NFAPI_VNF:LEGACY_GROUP_INFO:LEGACY
FORMAT = string,log
ID = LEGACY_NFAPI_VNF_ERROR
DESC = NFAPI_VNF legacy logs - error level
GROUP = ALL:LEGACY_NFAPI_VNF:LEGACY_GROUP_ERROR:LEGACY
FORMAT = string,log
ID = LEGACY_NFAPI_VNF_WARNING
DESC = NFAPI_VNF legacy logs - warning level
GROUP = ALL:LEGACY_NFAPI_VNF:LEGACY_GROUP_WARNING:LEGACY
FORMAT = string,log
ID = LEGACY_NFAPI_VNF_DEBUG
DESC = NFAPI_VNF legacy logs - debug level
GROUP = ALL:LEGACY_NFAPI_VNF:LEGACY_GROUP_DEBUG:LEGACY
FORMAT = string,log
ID = LEGACY_NFAPI_VNF_TRACE
DESC = NFAPI_VNF legacy logs - trace level
GROUP = ALL:LEGACY_NFAPI_VNF:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log
ID = LEGACY_NFAPI_PNF_INFO
DESC = NFAPI_PNF legacy logs - info level
GROUP = ALL:LEGACY_NFAPI_PNF:LEGACY_GROUP_INFO:LEGACY
FORMAT = string,log
ID = LEGACY_NFAPI_PNF_ERROR
DESC = NFAPI_PNF legacy logs - error level
GROUP = ALL:LEGACY_NFAPI_PNF:LEGACY_GROUP_ERROR:LEGACY
FORMAT = string,log
ID = LEGACY_NFAPI_PNF_WARNING
DESC = NFAPI_PNF legacy logs - warning level
GROUP = ALL:LEGACY_NFAPI_PNF:LEGACY_GROUP_WARNING:LEGACY
FORMAT = string,log
ID = LEGACY_NFAPI_PNF_DEBUG
DESC = NFAPI_PNF legacy logs - debug level
GROUP = ALL:LEGACY_NFAPI_PNF:LEGACY_GROUP_DEBUG:LEGACY
FORMAT = string,log
ID = LEGACY_NFAPI_PNF_TRACE
DESC = NFAPI_PNF legacy logs - trace level
GROUP = ALL:LEGACY_NFAPI_PNF:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log
# this is a bad hack but I won't fix (function util_print_hex_octets # this is a bad hack but I won't fix (function util_print_hex_octets
# in openairinterface5g/openair2/LAYER2/PDCP_v10.1.0/pdcp_util.c # in openairinterface5g/openair2/LAYER2/PDCP_v10.1.0/pdcp_util.c
# does funky things with the LOG_x macros but we work on the C pre-processor # does funky things with the LOG_x macros but we work on the C pre-processor
...@@ -845,27 +886,7 @@ ID = LEGACY_componentP_TRACE ...@@ -845,27 +886,7 @@ ID = LEGACY_componentP_TRACE
GROUP = ALL:LEGACY_componentP:LEGACY_GROUP_TRACE:LEGACY GROUP = ALL:LEGACY_componentP:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log FORMAT = string,log
#needed?
ID = LEGACY_CLI_INFO
DESC = CLI legacy logs - info level
GROUP = ALL:LEGACY_CLI:LEGACY_GROUP_INFO:LEGACY
FORMAT = string,log
ID = LEGACY_CLI_ERROR
DESC = CLI legacy logs - error level
GROUP = ALL:LEGACY_CLI:LEGACY_GROUP_ERROR:LEGACY
FORMAT = string,log
ID = LEGACY_CLI_WARNING
DESC = CLI legacy logs - warning level
GROUP = ALL:LEGACY_CLI:LEGACY_GROUP_WARNING:LEGACY
FORMAT = string,log
ID = LEGACY_CLI_DEBUG
DESC = CLI legacy logs - debug level
GROUP = ALL:LEGACY_CLI:LEGACY_GROUP_DEBUG:LEGACY
FORMAT = string,log
ID = LEGACY_CLI_TRACE
DESC = CLI legacy logs - trace level
GROUP = ALL:LEGACY_CLI:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log
################# #################
#### UE LOGS #### #### UE LOGS ####
......
...@@ -211,7 +211,7 @@ void pnf_nfapi_trace(nfapi_trace_level_t nfapi_level, const char* message, ...) ...@@ -211,7 +211,7 @@ void pnf_nfapi_trace(nfapi_trace_level_t nfapi_level, const char* message, ...)
va_list args; va_list args;
va_start(args, message); va_start(args, message);
nfapi_log("FILE>", "FUNC", 999, PHY, nfapitooai_level(nfapi_level), message, args); VLOG( NFAPI_PNF, nfapitooai_level(nfapi_level), message, args);
va_end(args); va_end(args);
} }
......
...@@ -606,7 +606,8 @@ void vnf_deallocate(void *ptr) { ...@@ -606,7 +606,8 @@ void vnf_deallocate(void *ptr) {
void vnf_trace(nfapi_trace_level_t nfapi_level, const char *message, ...) { void vnf_trace(nfapi_trace_level_t nfapi_level, const char *message, ...) {
va_list args; va_list args;
va_start(args, message); va_start(args, message);
nfapi_log("FILE>", "FUNC", 999, PHY, nfapitooai_level(nfapi_level), message, args); VLOG( NFAPI_VNF, nfapitooai_level(nfapi_level), message, args);
va_end(args); va_end(args);
} }
......
...@@ -4094,7 +4094,7 @@ uint8_t check_trigger_meas_event( ...@@ -4094,7 +4094,7 @@ uint8_t check_trigger_meas_event(
uint8_t eNB_offset; uint8_t eNB_offset;
// uint8_t currentCellIndex = frame_parms->Nid_cell; // uint8_t currentCellIndex = frame_parms->Nid_cell;
uint8_t tmp_offset; uint8_t tmp_offset;
LOG_I(RRC,"[UE %d] ofn(%ld) ocn(%ld) hys(%ld) ofs(%ld) ocs(%ld) a3_offset(%ld) ttt(%ld) rssi %3.1f\n", LOG_T(RRC,"[UE %d] ofn(%ld) ocn(%ld) hys(%ld) ofs(%ld) ocs(%ld) a3_offset(%ld) ttt(%ld) rssi %3.1f\n",
ue_mod_idP, ue_mod_idP,
ofn,ocn,hys,ofs,ocs,a3_offset,ttt, ofn,ocn,hys,ofs,ocs,a3_offset,ttt,
10*log10(get_RSSI(ue_mod_idP,0))-get_rx_total_gain_dB(ue_mod_idP,0)); 10*log10(get_RSSI(ue_mod_idP,0))-get_rx_total_gain_dB(ue_mod_idP,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