Commit 2d4e3a05 authored by Robert Schmidt's avatar Robert Schmidt

Merge remote-tracking branch 'origin/simplify-log-module-interface' into integration_2024_w10

parents 132949c2 24d30ae7
This diff is collapsed.
......@@ -57,8 +57,6 @@
#ifdef NDEBUG
#warning assert is disabled
#endif
#define NUM_ELEMENTS(ARRAY) (sizeof(ARRAY) / sizeof(ARRAY[0]))
#define CHECK_INDEX(ARRAY, INDEX) assert((INDEX) < NUM_ELEMENTS(ARRAY))
#ifdef __cplusplus
extern "C" {
......@@ -87,31 +85,6 @@ extern "C" {
#define NUM_LOG_LEVEL 6 /*!< \brief the number of message levels users have with LOG (OAILOG_DISABLE is not available to user as a level, so it is not included)*/
/** @}*/
/** @defgroup _log_format Defined log format
* @ingroup _macro
* @brief Macro of log formats defined by LOG
* @{*/
/* .log_format = 0x13 uncolored standard messages
* .log_format = 0x93 colored standard messages */
/* keep white space in first position; switching it to 0 allows colors to be disabled*/
#define LOG_RED "\033[1;31m" /*!< \brief VT100 sequence for bold red foreground */
#define LOG_GREEN "\033[32m" /*!< \brief VT100 sequence for green foreground */
#define LOG_ORANGE "\033[93m" /*!< \brief VT100 sequence for orange foreground */
#define LOG_BLUE "\033[34m" /*!< \brief VT100 sequence for blue foreground */
#define LOG_CYBL "\033[40;36m" /*!< \brief VT100 sequence for cyan foreground on black background */
#define LOG_RESET "\033[0m" /*!< \brief VT100 sequence for reset (black) foreground */
#define FLAG_NOCOLOR 0x0001 /*!< \brief use colors in log messages, depending on level */
#define FLAG_THREAD 0x0008 /*!< \brief display thread name in log messages */
#define FLAG_LEVEL 0x0010 /*!< \brief display log level in log messages */
#define FLAG_FUNCT 0x0020
#define FLAG_FILE_LINE 0x0040
#define FLAG_TIME 0x0100
#define FLAG_THREAD_ID 0x0200
#define FLAG_REAL_TIME 0x0400
#define FLAG_INITIALIZED 0x8000
/** @}*/
#define SET_LOG_OPTION(O) g_log->flag = (g_log->flag | O)
#define CLEAR_LOG_OPTION(O) g_log->flag = (g_log->flag & (~O))
......@@ -140,92 +113,73 @@ extern "C" {
#define DEBUG_DLSCH_DECOD (1<<14)
#define UE_TIMING (1<<20)
#define LOG_MASKMAP_INIT {\
{"PRACH", DEBUG_PRACH},\
{"RU", DEBUG_RU},\
{"UE_PHYPROC", DEBUG_UE_PHYPROC},\
{"LTEESTIM", DEBUG_LTEESTIM},\
{"DLCELLSPEC", DEBUG_DLCELLSPEC},\
{"ULSCH", DEBUG_ULSCH},\
{"RRC", DEBUG_RRC},\
{"PDCP", DEBUG_PDCP},\
{"DFT", DEBUG_DFT},\
{"ASN1", DEBUG_ASN1},\
{"CTRLSOCKET", DEBUG_CTRLSOCKET},\
{"SECURITY", DEBUG_SECURITY},\
{"NAS", DEBUG_NAS},\
{"RLC", DEBUG_RLC},\
{"DLSCH_DECOD", DEBUG_DLSCH_DECOD},\
{"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->dump_mask = (g_log->dump_mask | B)
#define CLEAR_LOG_DUMP(B) g_log->dump_mask = (g_log->dump_mask & (~B))
typedef enum {
MIN_LOG_COMPONENTS = 0,
PHY = MIN_LOG_COMPONENTS,
MAC,
EMU,
SIM,
OMG,
OPT,
OTG,
OTG_LATENCY,
OTG_LATENCY_BG,
OTG_GP,
OTG_GP_BG,
OTG_JITTER,
RLC,
PDCP,
RRC,
NAS,
PERF,
OIP,
CLI,
OCM,
UDP_,
GTPU,
SDAP,
SPGW,
S1AP,
F1AP,
E1AP,
SCTP,
HW,
OSA,
RAL_ENB,
RAL_UE,
ENB_APP,
MCE_APP,
MME_APP,
TMR,
USIM,
LOCALIZE,
F1U,
X2AP,
M2AP,
M3AP,
NGAP,
GNB_APP,
NR_RRC,
NR_MAC,
NR_MAC_DCI,
NR_PHY_DCI,
NR_PHY,
LOADER,
ASN1,
NFAPI_VNF,
NFAPI_PNF,
ITTI,
UTIL,
MAX_LOG_PREDEF_COMPONENTS,
} comp_name_t;
#define FOREACH_COMP(COMP_DEF) \
COMP_DEF(PHY, log) \
COMP_DEF(MAC, log) \
COMP_DEF(EMU, log) \
COMP_DEF(SIM, txt) \
COMP_DEF(OMG, csv) \
COMP_DEF(OPT, log) \
COMP_DEF(OTG, log) \
COMP_DEF(OTG_LATENCY, dat) \
COMP_DEF(OTG_LATENCY_BG, dat) \
COMP_DEF(OTG_GP, dat) \
COMP_DEF(OTG_GP_BG, dat) \
COMP_DEF(OTG_JITTER, dat) \
COMP_DEF(RLC, ) \
COMP_DEF(PDCP, ) \
COMP_DEF(RRC, ) \
COMP_DEF(NAS, log) \
COMP_DEF(OIP, ) \
COMP_DEF(CLI, ) \
COMP_DEF(OCM, ) \
COMP_DEF(GTPU, ) \
COMP_DEF(SDAP, ) \
COMP_DEF(SPGW, ) \
COMP_DEF(S1AP, ) \
COMP_DEF(F1AP, ) \
COMP_DEF(E1AP, ) \
COMP_DEF(SCTP, ) \
COMP_DEF(HW, ) \
COMP_DEF(OSA, ) \
COMP_DEF(ENB_APP, log) \
COMP_DEF(MCE_APP, log) \
COMP_DEF(MME_APP, log) \
COMP_DEF(TMR, ) \
COMP_DEF(USIM, log) \
COMP_DEF(F1U, ) \
COMP_DEF(X2AP, ) \
COMP_DEF(M2AP, ) \
COMP_DEF(M3AP, ) \
COMP_DEF(NGAP, ) \
COMP_DEF(GNB_APP, log) \
COMP_DEF(NR_RRC, log) \
COMP_DEF(NR_MAC, log) \
COMP_DEF(NR_MAC_DCI, log) \
COMP_DEF(NR_PHY_DCI, log) \
COMP_DEF(NR_PHY, log) \
COMP_DEF(LOADER, log) \
COMP_DEF(ASN1, log) \
COMP_DEF(NFAPI_VNF, log) \
COMP_DEF(NFAPI_PNF, log) \
COMP_DEF(ITTI, log) \
COMP_DEF(UTIL, log) \
COMP_DEF(MAX_LOG_PREDEF_COMPONENTS, )
#define COMP_ENUM(comp, file_extension) comp,
typedef enum { FOREACH_COMP(COMP_ENUM) } comp_name_t;
#define COMP_TEXT(comp, file_extension) #comp,
static const char *const comp_name[] = {FOREACH_COMP(COMP_TEXT)};
#define COMP_EXTENSION(comp, file_extension) #file_extension,
static const char *const comp_extension[] = {FOREACH_COMP(COMP_EXTENSION)};
#define MAX_LOG_DYNALLOC_COMPONENTS 20
#define MAX_LOG_COMPONENTS (MAX_LOG_PREDEF_COMPONENTS + MAX_LOG_DYNALLOC_COMPONENTS)
......@@ -237,23 +191,24 @@ typedef struct {
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 {
int savedlevel;
char *filelog_name;
} log_component_back_t;
typedef struct {
const char *name;
int level;
int savedlevel;
int flag;
int filelog;
char *filelog_name;
int level;
int filelog;
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_print_func_t print;
} log_component_t;
typedef struct {
log_component_t log_component[MAX_LOG_COMPONENTS];
log_component_back_t log_rarely_used[MAX_LOG_COMPONENTS];
char level2string[NUM_LOG_LEVEL];
int flag;
char *filelog_name;
......@@ -272,8 +227,7 @@ extern "C" {
}
#endif
#endif
/*--- INCLUDES ---------------------------------------------------------------*/
# include "log_if.h"
/*----------------------------------------------------------------------------*/
int logInit (void);
void logTerm (void);
......@@ -284,6 +238,9 @@ void log_dump(int component, void *buffer, int buffsize,int datatype, const char
int set_log(int component, int level);
void set_glog(int level);
mapping * log_level_names_ptr(void);
mapping * log_option_names_ptr(void);
mapping * log_maskmap_ptr(void);
void set_glog_onlinelog(int enable);
void set_glog_filelog(int enable);
void set_component_filelog(int comp);
......@@ -292,21 +249,11 @@ void set_component_consolelog(int comp);
int map_str_to_int(const mapping *map, const char *str);
char *map_int_to_str(const mapping *map, const int val);
void logClean (void);
int is_newline( char *str, int size);
int register_log_component(char *name, char *fext, int compidx);
int register_log_component(const char *name, const char *fext, int compidx);
#define LOG_MEM_SIZE 100*1024*1024
#define LOG_MEM_FILE "./logmem.log"
void flush_mem_to_file(void);
int logInit_log_mem(void);
int logInit_log_mem(char*);
void close_log_mem(void);
typedef struct {
char* buf_p;
int buf_index;
int enable_flag;
} log_mem_cnt_t;
/** @}*/
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "log.h"
extern log_t *g_log;
extern const mapping log_level_names[];
extern const mapping log_options[];
extern const mapping log_maskmap[];
extern int log_mem_flag;
extern char * log_mem_filename;
extern char logmem_filename[1024];
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file log_if.h
* \brief log interface
* \author Navid Nikaein
* \date 2009 - 2014
* \version 0.3
* \warning This component can be runned only in user-space
* @ingroup routing
*/
// LTS: kept this file for compatibility
// this file was probably a trial to separate internal functions and external ones
// but it has never been finished, most source code include directly log.h (not log_if.h)
#include "log.h"
This diff is collapsed.
......@@ -18,6 +18,7 @@ extern "C" {
#endif
#define sizeofArray(a) (sizeof(a)/sizeof(*(a)))
#define CHECK_INDEX(ARRAY, INDEX) assert((INDEX) < sizeofArray(ARRAY))
// Prevent double evaluation in max macro
#define cmax(a,b) ({ __typeof__ (a) _a = (a); \
......
......@@ -902,7 +902,6 @@ INPUT = \
@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/LOG/vcd_signal_dumper.h \
@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/LOG/log.c \
@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/LOG/log.h \
@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/LOG/log_extern.h \
@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/time_stat.h \
@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/ocp_itti/all_msg.h \
@CMAKE_CURRENT_SOURCE_DIR@/../common/utils/ocp_itti/intertask_interface.h \
......
......@@ -69,7 +69,7 @@
#include "common/ran_context.h"
#include "RRC/LTE/rrc_extern.h"
#include "PHY_INTERFACE/phy_interface.h"
#include "common/utils/LOG/log_extern.h"
#include "common/utils/LOG/log.h"
#include "UTIL/OTG/otg_tx.h"
#include "UTIL/OTG/otg_externs.h"
#include "UTIL/MATH/oml.h"
......
......@@ -138,10 +138,8 @@ void get_common_options(configmodule_interface_t *cfg, uint32_t execmask)
}
if (logmem_filename != NULL && strlen(logmem_filename) > 0) {
log_mem_filename = &logmem_filename[0];
log_mem_flag = 1;
printf("Enabling OPT for log save at memory %s\n",log_mem_filename);
logInit_log_mem();
printf("Enabling OPT for log save at memory %s\n",logmem_filename);
logInit_log_mem(logmem_filename);
}
if (noS1) {
......
......@@ -953,7 +953,7 @@ typedef enum {no_relay=1,unicast_relay_type1,unicast_relay_type2, multicast_rela
#define NB_BANDS_MAX 8
#include "common/utils/LOG/log_extern.h"
#include "common/utils/LOG/log.h"
extern pthread_cond_t sync_cond;
extern pthread_mutex_t sync_mutex;
extern int sync_var;
......
......@@ -39,7 +39,7 @@
#include "LAYER2/MAC/defs.h"
#include "PHY_INTERFACE/defs.h"
#include "LAYER2/MAC/vars.h"
#include "UTIL/LOG/log_extern.h"
#include "UTIL/LOG/log.h"
uint16_t n_rnti = 0x1235;
int n_users = 1;
......
......@@ -31,7 +31,7 @@
#include "SCHED/vars.h"
#include "LAYER2/MAC/vars.h"
#include "UTIL/LOG/log_extern.h"
#include "UTIL/LOG/log.h"
#include "unitary_defs.h"
......
......@@ -24,7 +24,6 @@
#include <arpa/inet.h>
#include "common/utils/LOG/log.h"
#include "common/utils/nr/nr_common.h"
#include "common/utils/LOG/log_extern.h"
#include "assertions.h"
#include "common/utils/ocp_itti/intertask_interface.h"
#include "openair2/GNB_APP/gnb_paramdef.h"
......
......@@ -31,7 +31,6 @@
#include <inttypes.h>
#include "log.h"
#include "log_extern.h"
#include "assertions.h"
#include "intertask_interface.h"
#include "s1ap_eNB.h"
......
......@@ -32,7 +32,6 @@
#include "common/utils/LOG/log.h"
#include "common/utils/nr/nr_common.h"
#include "common/utils/LOG/log_extern.h"
#include "assertions.h"
#include "oai_asn1.h"
#include "executables/softmodem-common.h"
......
......@@ -27,7 +27,7 @@
*/
#include "pdcp_sequence_manager.h"
#include "common/utils//LOG/log_if.h"
#include "common/utils/LOG/log.h"
#include "pdcp_util.h"
/*
......
......@@ -1957,7 +1957,7 @@ static int get_mcs_from_sinr(float sinr)
static int get_cqi_from_mcs(void)
{
static const int mcs_to_cqi[] = {0, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15};
assert(NUM_ELEMENTS(mcs_to_cqi) == NUM_MCS);
assert(sizeofArray(mcs_to_cqi) == NUM_MCS);
int sf = 0;
while(sf < NUM_NFAPI_SUBFRAME)
{
......
......@@ -32,7 +32,6 @@
#include "cli.h"
#include "log.h"
#include "log_extern.h"
extern cli_config *cli_cfg;
......
......@@ -48,7 +48,7 @@ This header file must be included */
#endif
#ifndef project_include
#define project_include
#include "common/utils/LOG/log_if.h"
#include "common/utils/LOG/log.h"
#include "PHY/defs_RU.h"
#endif
......
......@@ -19,7 +19,7 @@
#include <cmath>
#include <time.h>
#include <limits>
#include "common/utils/LOG/log_extern.h"
#include "common/utils/LOG/log.h"
#include "common_lib.h"
#include <chrono>
......
......@@ -32,8 +32,7 @@
#include "LAYER2/RLC/AM_v9.3.0/rlc_am.h"
#include "LAYER2/MAC/defs.h"
#include "LAYER2/MAC/vars.h"
#include "UTIL/LOG/log_if.h"
#include "UTIL/LOG/log_extern.h"
#include "UTIL/LOG/log.h"
#include "RRC/LTE/vars.h"
#include "PHY_INTERFACE/vars.h"
#include "UTIL/AT_COMMANDS/parser.h"
......
......@@ -27,7 +27,7 @@
#include "MAC_INTERFACE/vars.h"
#include "LAYER2/MAC/vars.h"
#include "UTIL/LOG/log_if.h"
#include "UTIL/LOG/log.h"
#include "test_util.h"
#include "test_pdcp.h"
......
......@@ -32,8 +32,7 @@
#include "LAYER2/MAC/defs.h"
#include "LAYER2/MAC/vars.h"
#include "UTIL/LOG/log_if.h"
#include "UTIL/LOG/log_extern.h"
#include "UTIL/LOG/log.h"
#include "RRC/LTE/vars.h"
#include "PHY_INTERFACE/vars.h"
#include "LAYER2/PDCP_v10.1.0/pdcp.h"
......
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