From 00f4890b14b917fe80010b30072b1cf04f3c4815 Mon Sep 17 00:00:00 2001 From: frtabu Date: Fri, 16 Nov 2018 17:53:51 +0100 Subject: [PATCH 01/10] write logging tool documentation --- common/utils/DOC/loader/devusage.md | 7 +- common/utils/LOG/DOC/arch.md | 9 + common/utils/LOG/DOC/devusage.md | 119 +++++++++++ common/utils/LOG/DOC/log.md | 19 ++ common/utils/LOG/DOC/rtusage.md | 265 ++++++++++++++++++++++++ common/utils/telnetsrv/DOC/telnetlog.md | 3 +- 6 files changed, 417 insertions(+), 5 deletions(-) create mode 100644 common/utils/LOG/DOC/arch.md create mode 100644 common/utils/LOG/DOC/devusage.md create mode 100644 common/utils/LOG/DOC/log.md create mode 100644 common/utils/LOG/DOC/rtusage.md diff --git a/common/utils/DOC/loader/devusage.md b/common/utils/DOC/loader/devusage.md index 4b82e18362..915075c361 100644 --- a/common/utils/DOC/loader/devusage.md +++ b/common/utils/DOC/loader/devusage.md @@ -1,7 +1,6 @@ -The configuration module objectives are -1. Allow easy parameters management in oai, helping the development of a flexible, modularized and fully configurable softmodem. -1. Use a common configuration API in all oai modules -1. Allow development of alternative configuration sources without modifying the oai code. Today the only delivered configuration source is the libconfig format configuration file. +The loader objectives are +1. provides a common mechanism to prevent an executable to include code that is only used under specific configurations, without rebuilding the code +1. Provide a common mechanism to allow to choose between different implementations of a given set of functions, without rebuilding the code As a developer you may need to look at these sections: diff --git a/common/utils/LOG/DOC/arch.md b/common/utils/LOG/DOC/arch.md new file mode 100644 index 0000000000..f774655771 --- /dev/null +++ b/common/utils/LOG/DOC/arch.md @@ -0,0 +1,9 @@ +# logging facility source files + +The oai logging facility is implemented in two source files, located in [common/utils](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils) +1. [log.c](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/log.c) contains logging implementation +1. [log.h](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/log.h) is the logging facility include file containing both private and public data type definitions. It also contain API prototypes. + + +[logging facility main page](log.md) +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) \ No newline at end of file diff --git a/common/utils/LOG/DOC/devusage.md b/common/utils/LOG/DOC/devusage.md new file mode 100644 index 0000000000..2d5582ff7c --- /dev/null +++ b/common/utils/LOG/DOC/devusage.md @@ -0,0 +1,119 @@ +### logging facility usage +The logging facility objectives are +1. provide a common console tracing mechanism +1. Allow a flexible activation of console traces, by configuration or dynamically at any time while code is running. + +Once the logging facility has been initialized and configured developpers use C preprocessor macros to include console messages in their code. At execution time, these traces will be printed or not to the console depending on the configuration, as described [here](rtusage.md). The logging facility also defines preprocessor macros to include condtional code, to dump memory blocks (buffers, messages...). + +All macros are defined in [log.h](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.h) include file, which must be included in any source file using the logging facility macros. + + [log.h](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.h) also includes the prototypes of the functions that have to be called to initialize, configure or get the status of console logs. + +#### console messages macros +```C +LOG_E(,,,...) +LOG_W(,,,...) +LOG_I(,,,...) +LOG_D(,,,...) +LOG_T(,,,...) +) +``` +these macros are used in place of the printf C function. The additionnal ***component*** parameter identifies the functionnal module which generates the message. At run time, the message will only be printed if the configured log level for the component is greater or equal than the macro level used in the code. + +| macro | level letter | level value | level name | +|:---------|:---------------|:---------------|----------------:| +| LOG_E | E | 0 | error | +| LOG_W | W | 1 | warning | +| LOG_I | I | 2 | informational | +| LOG_D | D | 3 | debug | +| LOG_T | T | 4 | trace | + +component list is defined as an `enum` in [log.h](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.h). A new component can be defined by adding an item in this type, it must also be defined in the T tracer [T_messages.txt ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/T/T_messages.txt). + +Most oai sources are including LOG macros. + +#### conditional code macros + +```C +LOG_DEBUGFLAG() +``` +this macro is to be used in if statements. The condition is true if the flag has been set, as described in the [run time usage page](rtusage.md) +```C +if ( LOG_DEBUGFLAG() { +/* + the code below is only executed if the corresponding + _debug option is set. + */ +...................... +...................... +} +``` +[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c#L396) + +#### memory dump macros +```C +LOG_DUMPFLAG() +``` +this macro is to be used in if statements. The condition is true if the flag has been set, as described in the [run time usage page](rtusage.md). It is mainly provided to surround LOG_M macros or direct calls to `log_dump`which otherwise would be unconditionals. +```C +if ( LOG_DUMPFLAG() { +/* + the code below is only executed if the corresponding + _dump option is set. + */ +LOG_M(............. +LOG_M(............. +log_dump(... +} + +[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/prach.c#L205) +#### matlab format dump +```C +LOG_M(file, vector, data, len, dec, format) +``` +|argument| type| description | +|:-----------|:-------|-----------------:| +| file | char* |path to the fle which will contain the dump | +|vector |char * |name of the dump, printed at the top of the dump file | +|data| void *| pointer to the memory to be dumpped | +|len | int | length of the data to be dumpped, in `dec` unit| +| dec| int | length of each data item.Interpretation depends on format| +|format| int | defines the type of data to be dumped| + +This macro can be used to dump a buffer in a format that can be used for analyze via tools like matlab or octave. **It must be surrounded by LOG_DEBUGFLAG or LOG_DUMPFLAG macros, to prevent the dump to be built unconditionally.** The LOG_M macro points to the `write_file_matlab` function implemented in [log.c](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.c). **This function should be revisited for more understandable implementation and ease of use (format parameter ???)** +[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/prach.c#L205) + +#### hexadecimal format dump +```C +LOG_DUMPMSG(c, f, b, s, x...) +``` +dumps a memory region if the corresponding debug flag `f` is set as explained here [run time usage page](rtusage.md) + +|argument| type| description | +|:-----------|:-------|-----------------:| +| c | int, component id (in `comp_name_t` enum)| used to print the message, as specified by the s and x arguments | +|f |int |flag used to filter the dump depending on the logs configuration. flag list is defined by the LOG_MASKMAP_INIT macro in [log.h](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.h) | +|b| void *| pointer to the memory to be dumpped | +|s | int | length of the data to be dumpped in char| +| x...| printf format and arguments| text string to be printed at the top of the dump| + +This macro can be used to conditionaly dump a buffer, bytes by bytes, giving the integer value of each byte in hexadecimal form. +[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair2/RRC/LTE/rrc_eNB.c#L1181) + +This macro points to the `log_dump` function, implemented in [log.c](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.c). This function can also dump buffers containing `double` data via the LOG_UDUMPMSG macro + +```C +LOG_UDUMPMSG(c, b, s, f, x...) +``` +|argument| type| description | +|:-----------|:-------|-----------------:| +| c | int, component id (in `comp_name_t` enum)| used to print the message, as specified by the s and x arguments | +|b| void *| pointer to the memory to be dumpped | +|s | int | length of the data to be dumpped in char| +|f| int | format of dumped data LOG_DUMP_CHAR or LOG_DUMP_DOUBLE| +| x...| printf format and arguments| text string to be printed at the top of the dump| + +[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/SIMULATION/LTE_PHY/dlsim.c#L1974) + +[logging facility main page](log.md) +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) diff --git a/common/utils/LOG/DOC/log.md b/common/utils/LOG/DOC/log.md new file mode 100644 index 0000000000..d7a94d5bbd --- /dev/null +++ b/common/utils/LOG/DOC/log.md @@ -0,0 +1,19 @@ +# OAI console logging facility + +oai includes a console logging facility that any component should use when writting informational or debugging messages to the softmodem or uesoftmodem stdout stream. +By default, this facility is included at build-time and activated at run-time. The T Tracer and the Logging facility share common options for activation: + +- To disable the logging facility (and T Tracer) at build-time use the *--disable-T-Tracer* switch: + +```bash +/build_oai --disable-T-Tracer +``` +- To use the the T-Tracer instead of the console logging facility, use the command line option *T_stdout*. *T_stdout* is a boolean option, which, when set to 0 (false) disable the console logging facility. All stdout messages are then sent to the T-Tracer. + +## Documentation + +* [runtime usage](rtusage.md) +* [developer usage](config/devusage.md) +* [module architecture](arch.md) + +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) diff --git a/common/utils/LOG/DOC/rtusage.md b/common/utils/LOG/DOC/rtusage.md new file mode 100644 index 0000000000..60835bafaf --- /dev/null +++ b/common/utils/LOG/DOC/rtusage.md @@ -0,0 +1,265 @@ +## configuring the logging facility +The logging facility is fully configurable and it uses the [config module](../../../config/config.md) to get its parameters at init time. The [telnet server](../../telnetsrv/DOC/telnetsrv.md) includes a set of commands which can be used to dynamically modify the logging facility behavior + +All logging facility parameters are defined in the log_config section. Some parameters are global to the logging facility, they modify the way messages are printed to stdout. Conversely, some parameters are specific to a component and only modify the behavior for messages issued by a given component. A third type of parameters can be used to activate conditional debug code or dump messages or buffers. + +### global parameters + +| name | type | default | description | +|:---:|:---:|:---:|:----| +| `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| + +### Component specific parameters +| name | type | default | description | +|:---:|:---:|:---:|:----| +| `_log_level` | `boolean` | global log level, as defined by the `global_log_level ` parameter) | +| `_log_infile` | `boolean` | 0 = false| Triggers the redirection of log messages printed by the specified component in a file. The file path and name is /tmp/.[extension] the extension is optional and component dependant, it can be `log `, `dat `, `txt `| + +The list of components defined within oai can be retrieved from the [config module](../../../config/config.md) traces, when asking for config module debugging info on the command line: + +```bash +./lte-softmodem -O libconfig::dbgl5 + +[LIBCONFIG] log_config.global_log_level: "info" +[CONFIG] global_log_online: 1 +[CONFIG] log_config.global_log_online set to default value +[LIBCONFIG] log_config: 3/3 parameters successfully set, (1 to default value) +[LIBCONFIG] global_log_options[0]: nocolor +[LIBCONFIG] global_log_options[1]: level +[LIBCONFIG] global_log_options[2]: thread +[CONFIG] log_config 1 options set from command line +[LIBCONFIG] log_config.phy_log_level: "info" +[LIBCONFIG] log_config.mac_log_level: "info" +[CONFIG] log_config.sim_log_level set to default value "info" +[CONFIG] log_config.ocg_log_level set to default value "info" +[CONFIG] log_config.omg_log_level set to default value "info" +[CONFIG] log_config.opt_log_level set to default value "info" +[CONFIG] log_config.otg_log_level set to default value "info" +[CONFIG] log_config.otg_latency_log_level set to default value "info" +[CONFIG] log_config.otg_latency_bg_log_level set to default value "info" +[CONFIG] log_config.otg_gp_log_level set to default value "info" +[CONFIG] log_config.otg_gp_bg_log_level set to default value "info" +[CONFIG] log_config.otg_jitter_log_level set to default value "info" +[LIBCONFIG] log_config.rlc_log_level: "info" +[LIBCONFIG] log_config.pdcp_log_level: "info" +[LIBCONFIG] log_config.rrc_log_level: "info" +[CONFIG] log_config.nas_log_level set to default value "info" +[CONFIG] log_config.perf_log_level set to default value "info" +[CONFIG] log_config.oip_log_level set to default value "info" +[CONFIG] log_config.cli_log_level set to default value "info" +[CONFIG] log_config.msc_log_level set to default value "info" +[CONFIG] log_config.ocm_log_level set to default value "info" +[CONFIG] log_config.udp_log_level set to default value "info" +[CONFIG] log_config.gtpv1u_log_level set to default value "info" +[CONFIG] log_config.comp23?_log_level set to default value "info" +[CONFIG] log_config.s1ap_log_level set to default value "info" +[CONFIG] log_config.sctp_log_level set to default value "info" +[LIBCONFIG] log_config.hw_log_level: "info" +[CONFIG] log_config.osa_log_level set to default value "info" +[CONFIG] log_config.eral_log_level set to default value "info" +[CONFIG] log_config.mral_log_level set to default value "info" +[CONFIG] log_config.enb_app_log_level set to default value "info" +[CONFIG] log_config.flexran_agent_log_level set to default value "info" +[CONFIG] log_config.tmr_log_level set to default value "info" +[CONFIG] log_config.usim_log_level set to default value "info" +[CONFIG] log_config.localize_log_level set to default value "info" +[CONFIG] log_config.x2ap_log_level set to default value "info" +[CONFIG] log_config.loader_log_level set to default value "info" +[CONFIG] log_config.asn_log_level set to default value "info" +[LIBCONFIG] log_config: 38/38 parameters successfully set, (32 to default value) +[CONFIG] log_config 0 options set from command line +[CONFIG] phy_log_infile: 0 +[CONFIG] log_config.phy_log_infile set to default value +[CONFIG] mac_log_infile: 0 +[CONFIG] log_config.mac_log_infile set to default value +[CONFIG] sim_log_infile: 0 +[CONFIG] log_config.sim_log_infile set to default value +[CONFIG] ocg_log_infile: 0 +[CONFIG] log_config.ocg_log_infile set to default value +[CONFIG] omg_log_infile: 0 +[CONFIG] log_config.omg_log_infile set to default value +[CONFIG] opt_log_infile: 0 +[CONFIG] log_config.opt_log_infile set to default value +[CONFIG] otg_log_infile: 0 +[CONFIG] log_config.otg_log_infile set to default value +[CONFIG] otg_latency_log_infile: 0 +[CONFIG] log_config.otg_latency_log_infile set to default value +[CONFIG] otg_latency_bg_log_infile: 0 +[CONFIG] log_config.otg_latency_bg_log_infile set to default value +[CONFIG] otg_gp_log_infile: 0 +[CONFIG] log_config.otg_gp_log_infile set to default value +[CONFIG] otg_gp_bg_log_infile: 0 +[CONFIG] log_config.otg_gp_bg_log_infile set to default value +[CONFIG] otg_jitter_log_infile: 0 +[CONFIG] log_config.otg_jitter_log_infile set to default value +[CONFIG] rlc_log_infile: 0 +[CONFIG] log_config.rlc_log_infile set to default value +[CONFIG] pdcp_log_infile: 0 +[CONFIG] log_config.pdcp_log_infile set to default value +[CONFIG] rrc_log_infile: 0 +[CONFIG] log_config.rrc_log_infile set to default value +[CONFIG] nas_log_infile: 0 +[CONFIG] log_config.nas_log_infile set to default value +[CONFIG] perf_log_infile: 0 +[CONFIG] log_config.perf_log_infile set to default value +[CONFIG] oip_log_infile: 0 +[CONFIG] log_config.oip_log_infile set to default value +[CONFIG] cli_log_infile: 0 +[CONFIG] log_config.cli_log_infile set to default value +[CONFIG] msc_log_infile: 0 +[CONFIG] log_config.msc_log_infile set to default value +[CONFIG] ocm_log_infile: 0 +[CONFIG] log_config.ocm_log_infile set to default value +[CONFIG] udp_log_infile: 0 +[CONFIG] log_config.udp_log_infile set to default value +[CONFIG] gtpv1u_log_infile: 0 +[CONFIG] log_config.gtpv1u_log_infile set to default value +[CONFIG] comp23?_log_infile: 0 +[CONFIG] log_config.comp23?_log_infile set to default value +[CONFIG] s1ap_log_infile: 0 +[CONFIG] log_config.s1ap_log_infile set to default value +[CONFIG] sctp_log_infile: 0 +[CONFIG] log_config.sctp_log_infile set to default value +[CONFIG] hw_log_infile: 0 +[CONFIG] log_config.hw_log_infile set to default value +[CONFIG] osa_log_infile: 0 +[CONFIG] log_config.osa_log_infile set to default value +[CONFIG] eral_log_infile: 0 +[CONFIG] log_config.eral_log_infile set to default value +[CONFIG] mral_log_infile: 0 +[CONFIG] log_config.mral_log_infile set to default value +[CONFIG] enb_app_log_infile: 0 +[CONFIG] log_config.enb_app_log_infile set to default value +[CONFIG] flexran_agent_log_infile: 0 +[CONFIG] log_config.flexran_agent_log_infile set to default value +[CONFIG] tmr_log_infile: 0 +[CONFIG] log_config.tmr_log_infile set to default value +[CONFIG] usim_log_infile: 0 +[CONFIG] log_config.usim_log_infile set to default value +[CONFIG] localize_log_infile: 0 +[CONFIG] log_config.localize_log_infile set to default value +[CONFIG] x2ap_log_infile: 0 +[CONFIG] log_config.x2ap_log_infile set to default value +[CONFIG] loader_log_infile: 0 +[CONFIG] log_config.loader_log_infile set to default value +[CONFIG] asn_log_infile: 0 +[CONFIG] log_config.asn_log_infile set to default value +[LIBCONFIG] log_config: 38/38 parameters successfully set, (38 to default value) +[CONFIG] log_config 0 options set from command line +[CONFIG] PRACH_debug: 0 +[CONFIG] log_config.PRACH_debug set to default value +[CONFIG] RU_debug: 0 +[CONFIG] log_config.RU_debug set to default value +[CONFIG] UE_PHYPROC_debug: 0 +[CONFIG] log_config.UE_PHYPROC_debug set to default value +[CONFIG] LTEESTIM_debug: 0 +[CONFIG] log_config.LTEESTIM_debug set to default value +[CONFIG] DLCELLSPEC_debug: 0 +[CONFIG] log_config.DLCELLSPEC_debug set to default value +[CONFIG] ULSCH_debug: 0 +[CONFIG] log_config.ULSCH_debug set to default value +[CONFIG] RRC_debug: 0 +[CONFIG] log_config.RRC_debug set to default value +[CONFIG] PDCP_debug: 0 +[CONFIG] log_config.PDCP_debug set to default value +[CONFIG] DFT_debug: 0 +[CONFIG] log_config.DFT_debug set to default value +[CONFIG] ASN1_debug: 0 +[CONFIG] log_config.ASN1_debug set to default value +[CONFIG] CTRLSOCKET_debug: 0 +[CONFIG] log_config.CTRLSOCKET_debug set to default value +[CONFIG] SECURITY_debug: 0 +[CONFIG] log_config.SECURITY_debug set to default value +[CONFIG] NAS_debug: 0 +[CONFIG] log_config.NAS_debug set to default value +[CONFIG] RLC_debug: 0 +[CONFIG] log_config.RLC_debug set to default value +[CONFIG] UE_TIMING_debug: 0 +[CONFIG] log_config.UE_TIMING_debug set to default value +[LIBCONFIG] log_config: 15/15 parameters successfully set, (15 to default value) +[CONFIG] log_config 0 options set from command line +[CONFIG] PRACH_dump: 0 +[CONFIG] log_config.PRACH_dump set to default value +[CONFIG] RU_dump: 0 +[CONFIG] log_config.RU_dump set to default value +[CONFIG] UE_PHYPROC_dump: 0 +[CONFIG] log_config.UE_PHYPROC_dump set to default value +[CONFIG] LTEESTIM_dump: 0 +[CONFIG] log_config.LTEESTIM_dump set to default value +[CONFIG] DLCELLSPEC_dump: 0 +[CONFIG] log_config.DLCELLSPEC_dump set to default value +[CONFIG] ULSCH_dump: 0 +[CONFIG] log_config.ULSCH_dump set to default value +[CONFIG] RRC_dump: 0 +[CONFIG] log_config.RRC_dump set to default value +[CONFIG] PDCP_dump: 0 +[CONFIG] log_config.PDCP_dump set to default value +[CONFIG] DFT_dump: 0 +[CONFIG] log_config.DFT_dump set to default value +[CONFIG] ASN1_dump: 0 +[CONFIG] log_config.ASN1_dump set to default value +[CONFIG] CTRLSOCKET_dump: 0 +[CONFIG] log_config.CTRLSOCKET_dump set to default value +[CONFIG] SECURITY_dump: 0 +[CONFIG] log_config.SECURITY_dump set to default value +[CONFIG] NAS_dump: 0 +[CONFIG] log_config.NAS_dump set to default value +[CONFIG] RLC_dump: 0 +[CONFIG] log_config.RLC_dump set to default value +[CONFIG] UE_TIMING_dump: 0 +[CONFIG] log_config.UE_TIMING_dump set to default value +[LIBCONFIG] log_config: 15/15 parameters successfully set, (15 to default value) +[CONFIG] log_config 0 options set from command line +log init done + +``` +It can also be retrieved when using the telnet server, as explained [below](### Using the telnet server to configure the logging facility) + +### parameters to activate conditional code +| name | type | default | description | +|:---:|:---:|:---:|:----| +| `_debug` | `boolean` | 0 = false | Triggers the activation of conditional code identified by the specified flag. +| `_dump` | `boolean` | 0 = false| Triggers buffer dump, on the console in text form or in a file in matlab format, depending on the developper choice and forcasted usage| + +### Using the configuration file to configure the logging facility +The following example sets all components log level to info, exept for hw,phy,mac,rlc,pdcp,rrc which log levels are set to error or warning. +```bash + log_config : + { + global_log_level ="info"; + hw_log_level ="error"; + phy_log_level ="error"; + mac_log_level ="warn"; + rlc_log_level ="error" + pdcp_log_level ="error"; + rrc_log_level ="error"; + }; +``` +### Using the command line to configure the logging facility +Command line parameter values supersedes values specified in the configuration file. +```bash +./lte-softmodem -O --log_config.global_log_options nocolor,level,thread --log_config.prach_log_level debug --log_config.PRACH_debug +``` +In this example to get all the debug PRACH messages it is necessary to also set the PRACH_debug flag. This is a choice from the developper. +The log messages will be printed whithout color and the header will include the lmessage evel and the thread name: +```bash +[PHY]I ru thread Time in secs now: 104652566 +[PHY]I ru thread Time in secs last pps: 91827117 +[PHY]I ru thread RU 0 rf device ready +[PHY]I ru thread RU 0 no asynch_south interface +[MAC]E rxtx processing SCHED_MODE=0 +[PHY]I lte-softmodem PRACH (eNB) : running rx_prach for subframe 1, prach_FreqOffset 2, prach_ConfigIndex 0 , rootSequenceIndex 0 +[PHY]I lte-softmodem prach_I0 = 0.0 dB +[PHY]I rxtx processing max_I0 21, min_I0 0 +[PHY]I lte-softmodem PRACH (eNB) : running rx_prach for subframe 1, prach_FreqOffset 2, prach_ConfigIndex 0 , rootSequenceIndex 0 +[PHY]I lte-softmodem PRACH (eNB) : running rx_prach for subframe 1, prach_FreqOffset 2, prach_ConfigIndex 0 , rootSequenceIndex 0 +``` + +### Using the telnet server to configure the logging facility +The telnet server includes a `log` command which can be used to dymically modify the logging facility configuration parameters. +[telnet server ***softmodem log*** commands](../../telnetsrv/DOC/telnetlog.md) + +[logging facility main page](log.md) +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) diff --git a/common/utils/telnetsrv/DOC/telnetlog.md b/common/utils/telnetsrv/DOC/telnetlog.md index 7c1d4f0384..0faaf9c02e 100644 --- a/common/utils/telnetsrv/DOC/telnetlog.md +++ b/common/utils/telnetsrv/DOC/telnetlog.md @@ -92,4 +92,5 @@ Connection closed by foreign host. ``` [oai telnetserver home](telnetsrv.md) -[oai telnetserver usage home](telnetusage.md) \ No newline at end of file +[oai telnetserver usage home](telnetusage.md) +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) \ No newline at end of file From 2f8c3d6eaaafae786bcf02e9786d1276303925a6 Mon Sep 17 00:00:00 2001 From: Francois TABURET Date: Fri, 16 Nov 2018 18:04:49 +0100 Subject: [PATCH 02/10] fix broken links --- common/utils/LOG/DOC/arch.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/utils/LOG/DOC/arch.md b/common/utils/LOG/DOC/arch.md index f774655771..348216983b 100644 --- a/common/utils/LOG/DOC/arch.md +++ b/common/utils/LOG/DOC/arch.md @@ -1,8 +1,8 @@ # logging facility source files -The oai logging facility is implemented in two source files, located in [common/utils](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils) -1. [log.c](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/log.c) contains logging implementation -1. [log.h](https://gitlab.eurecom.fr/oai/openairinterface5g/tree/develop/common/utils/log.h) is the logging facility include file containing both private and public data type definitions. It also contain API prototypes. +The oai logging facility is implemented in two source files, located in [common/utils/LOG](LOG) +1. [log.c](../log.c) contains logging implementation +1. [log.h](../log.h) is the logging facility include file containing both private and public data type definitions. It also contain API prototypes. [logging facility main page](log.md) From 382981b7576ced16d957e4096b206260550285f0 Mon Sep 17 00:00:00 2001 From: Francois TABURET Date: Fri, 16 Nov 2018 18:05:54 +0100 Subject: [PATCH 03/10] fix broken link --- common/utils/LOG/DOC/log.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/utils/LOG/DOC/log.md b/common/utils/LOG/DOC/log.md index d7a94d5bbd..121e227f3d 100644 --- a/common/utils/LOG/DOC/log.md +++ b/common/utils/LOG/DOC/log.md @@ -13,7 +13,7 @@ By default, this facility is included at build-time and activated at run-time. T ## Documentation * [runtime usage](rtusage.md) -* [developer usage](config/devusage.md) +* [developer usage](devusage.md) * [module architecture](arch.md) [oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) From 220080741eef482ec8451c956ad24d59ab586a4f Mon Sep 17 00:00:00 2001 From: Francois TABURET Date: Fri, 16 Nov 2018 19:31:58 +0100 Subject: [PATCH 04/10] Update devusage.md --- common/utils/LOG/DOC/devusage.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/utils/LOG/DOC/devusage.md b/common/utils/LOG/DOC/devusage.md index 2d5582ff7c..f3d972a05d 100644 --- a/common/utils/LOG/DOC/devusage.md +++ b/common/utils/LOG/DOC/devusage.md @@ -115,5 +115,7 @@ LOG_UDUMPMSG(c, b, s, f, x...) [example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/SIMULATION/LTE_PHY/dlsim.c#L1974) +### logging facility APIs + [logging facility main page](log.md) [oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) From 682be3e2b4a5f4d58272e197a605ecd7596a6b5d Mon Sep 17 00:00:00 2001 From: frtabu Date: Mon, 19 Nov 2018 11:27:43 +0100 Subject: [PATCH 05/10] completing logging facility doc --- common/utils/LOG/DOC/addconsoletrace.md | 110 ++++++++++++++++++++++ common/utils/LOG/DOC/configurelog.md | 49 ++++++++++ common/utils/LOG/DOC/devusage.md | 116 +----------------------- 3 files changed, 163 insertions(+), 112 deletions(-) create mode 100644 common/utils/LOG/DOC/addconsoletrace.md create mode 100644 common/utils/LOG/DOC/configurelog.md diff --git a/common/utils/LOG/DOC/addconsoletrace.md b/common/utils/LOG/DOC/addconsoletrace.md new file mode 100644 index 0000000000..502e9d39d2 --- /dev/null +++ b/common/utils/LOG/DOC/addconsoletrace.md @@ -0,0 +1,110 @@ +### Adding console traces in oai code +#### console messages macros +```C +LOG_E(,,,...) +LOG_W(,,,...) +LOG_I(,,,...) +LOG_D(,,,...) +LOG_T(,,,...) +) +``` +these macros are used in place of the printf C function. The additionnal ***component*** parameter identifies the functionnal module which generates the message. At run time, the message will only be printed if the configured log level for the component is greater or equal than the macro level used in the code. + +| macro | level letter | level value | level name | +|:---------|:---------------|:---------------|----------------:| +| LOG_E | E | 0 | error | +| LOG_W | W | 1 | warning | +| LOG_I | I | 2 | informational | +| LOG_D | D | 3 | debug | +| LOG_T | T | 4 | trace | + +component list is defined as an `enum` in [log.h](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.h). A new component can be defined by adding an item in this type, it must also be defined in the T tracer [T_messages.txt ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/T/T_messages.txt). + +Most oai sources are including LOG macros. + +#### conditional code macros + +```C +LOG_DEBUGFLAG() +``` +this macro is to be used in if statements. The condition is true if the flag has been set, as described in the [run time usage page](rtusage.md) +```C +if ( LOG_DEBUGFLAG() { +/* + the code below is only executed if the corresponding + _debug option is set. + */ +...................... +...................... +} +``` +[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c#L396) + +#### memory dump macros +```C +LOG_DUMPFLAG() +``` +this macro is to be used in if statements. The condition is true if the flag has been set, as described in the [run time usage page](rtusage.md). It is mainly provided to surround LOG_M macros or direct calls to `log_dump`which otherwise would be unconditionals. +```C +if ( LOG_DUMPFLAG() { +/* + the code below is only executed if the corresponding + _dump option is set. + */ +LOG_M(............. +LOG_M(............. +log_dump(... +} + +[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/prach.c#L205) +#### matlab format dump +```C +LOG_M(file, vector, data, len, dec, format) +``` +|argument| type| description | +|:-----------|:-------|-----------------:| +| file | char* |path to the fle which will contain the dump | +|vector |char * |name of the dump, printed at the top of the dump file | +|data| void *| pointer to the memory to be dumpped | +|len | int | length of the data to be dumpped, in `dec` unit| +| dec| int | length of each data item.Interpretation depends on format| +|format| int | defines the type of data to be dumped| + +This macro can be used to dump a buffer in a format that can be used for analyze via tools like matlab or octave. **It must be surrounded by LOG_DEBUGFLAG or LOG_DUMPFLAG macros, to prevent the dump to be built unconditionally.** The LOG_M macro points to the `write_file_matlab` function implemented in [log.c](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.c). **This function should be revisited for more understandable implementation and ease of use (format parameter ???)** +[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/prach.c#L205) + +#### hexadecimal format dump +```C +LOG_DUMPMSG(c, f, b, s, x...) +``` +dumps a memory region if the corresponding debug flag `f` is set as explained here [run time usage page](rtusage.md) + +|argument| type| description | +|:-----------|:-------|-----------------:| +| c | int, component id (in `comp_name_t` enum)| used to print the message, as specified by the s and x arguments | +|f |int |flag used to filter the dump depending on the logs configuration. flag list is defined by the LOG_MASKMAP_INIT macro in [log.h](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.h) | +|b| void *| pointer to the memory to be dumpped | +|s | int | length of the data to be dumpped in char| +| x...| printf format and arguments| text string to be printed at the top of the dump| + +This macro can be used to conditionaly dump a buffer, bytes by bytes, giving the integer value of each byte in hexadecimal form. +[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair2/RRC/LTE/rrc_eNB.c#L1181) + +This macro points to the `log_dump` function, implemented in [log.c](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.c). This function can also dump buffers containing `double` data via the LOG_UDUMPMSG macro + +```C +LOG_UDUMPMSG(c, b, s, f, x...) +``` +|argument| type| description | +|:-----------|:-------|-----------------:| +| c | int, component id (in `comp_name_t` enum)| used to print the message, as specified by the s and x arguments | +|b| void *| pointer to the memory to be dumpped | +|s | int | length of the data to be dumpped in char| +|f| int | format of dumped data LOG_DUMP_CHAR or LOG_DUMP_DOUBLE| +| x...| printf format and arguments| text string to be printed at the top of the dump| + +[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/SIMULATION/LTE_PHY/dlsim.c#L1974) + +[logging facility developer main page](ldevusage.md) +[logging facility main page](log.md) +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) \ No newline at end of file diff --git a/common/utils/LOG/DOC/configurelog.md b/common/utils/LOG/DOC/configurelog.md new file mode 100644 index 0000000000..ee8c0972e6 --- /dev/null +++ b/common/utils/LOG/DOC/configurelog.md @@ -0,0 +1,49 @@ +### Initializing and configuring the logging facility + +#### logging facility APIs +```C +int logInit (void); +``` +Allocate the internal data used by the logging utility, set the configuration, using the [configuration module](../../../config/DOC/config.md) + +```C +void logClean (void) +``` +Reset console attributes (color settings) and possibly close opened log files. Logging facility is still usable after this call, the internal data are not freed. + +```C +int set_log(int component, int level) +void set_glog(int level) +``` +Set a component or all components logiing level. Messages which level is lower than this level are not printed to the console. + +```C +void set_glog_onlinelog(int enable) +``` +Enable or disable all logging messages. Even error level messages are discarded, which is not advised. This can be usefull to temporarily workaround high rate of logging messages. + +```C +void set_component_filelog(int comp) +void close_component_filelog(int comp) +``` + +Redirect or reset to stdout the output stream used by the logging facility. When the output stream is redirected to a file, it is created under /tmp with a hard-coded filename including the componemt name. + +```C +SET_LOG_DEBUG(flag) +CLEAR_LOG_DEBUG(flag) +SET_LOG_DUMP(flag) +CLEAR_LOG_DUMP(flag) +``` + These macros are used to set or clear the corresponding bit flag, trigerring the activation or un-activation of conditional code or memory dumps generation. + +Example of using the logging utility APIs can be found, for initialization and cleanup, in [lte-softmodem.c](../../../../targets/RT/USER/lte-softmodem.c) and in the [telnet server log command implementation](../../telnetsrv/telnetsrv_proccmd.c) for a complete access to the logging facility features. + +#### components and debug flags definitions + +Adding a new component is just adding an item in the `comp_name_t` enum defined in [log.h](../log.h) . You must also declare it in the T Tracer facility [message fefinitions](../../T/T_messages.txt). +To add a flag than can then be used for adding conditional code or memory dumps you have to add the flag definition in the `LOG_MASKMAP_INIT` macro, in [log.h](../log.h). + +[logging facility developer main page](ldevusage.md) +[logging facility main page](log.md) +[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) \ No newline at end of file diff --git a/common/utils/LOG/DOC/devusage.md b/common/utils/LOG/DOC/devusage.md index f3d972a05d..0e68be4414 100644 --- a/common/utils/LOG/DOC/devusage.md +++ b/common/utils/LOG/DOC/devusage.md @@ -1,121 +1,13 @@ -### logging facility usage +### logging facility developer usage The logging facility objectives are 1. provide a common console tracing mechanism 1. Allow a flexible activation of console traces, by configuration or dynamically at any time while code is running. -Once the logging facility has been initialized and configured developpers use C preprocessor macros to include console messages in their code. At execution time, these traces will be printed or not to the console depending on the configuration, as described [here](rtusage.md). The logging facility also defines preprocessor macros to include condtional code, to dump memory blocks (buffers, messages...). +Most developpers will only use the log macros to add console messages to the code. The logging facility also provides an api that is used for initialization and configuration. -All macros are defined in [log.h](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.h) include file, which must be included in any source file using the logging facility macros. +[Adding console traces in oaicode](addconsoletrace.md) +[Configuring the logging facility](configurelog.md) - [log.h](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.h) also includes the prototypes of the functions that have to be called to initialize, configure or get the status of console logs. - -#### console messages macros -```C -LOG_E(,,,...) -LOG_W(,,,...) -LOG_I(,,,...) -LOG_D(,,,...) -LOG_T(,,,...) -) -``` -these macros are used in place of the printf C function. The additionnal ***component*** parameter identifies the functionnal module which generates the message. At run time, the message will only be printed if the configured log level for the component is greater or equal than the macro level used in the code. - -| macro | level letter | level value | level name | -|:---------|:---------------|:---------------|----------------:| -| LOG_E | E | 0 | error | -| LOG_W | W | 1 | warning | -| LOG_I | I | 2 | informational | -| LOG_D | D | 3 | debug | -| LOG_T | T | 4 | trace | - -component list is defined as an `enum` in [log.h](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.h). A new component can be defined by adding an item in this type, it must also be defined in the T tracer [T_messages.txt ](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/T/T_messages.txt). - -Most oai sources are including LOG macros. - -#### conditional code macros - -```C -LOG_DEBUGFLAG() -``` -this macro is to be used in if statements. The condition is true if the flag has been set, as described in the [run time usage page](rtusage.md) -```C -if ( LOG_DEBUGFLAG() { -/* - the code below is only executed if the corresponding - _debug option is set. - */ -...................... -...................... -} -``` -[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/ulsch_demodulation.c#L396) - -#### memory dump macros -```C -LOG_DUMPFLAG() -``` -this macro is to be used in if statements. The condition is true if the flag has been set, as described in the [run time usage page](rtusage.md). It is mainly provided to surround LOG_M macros or direct calls to `log_dump`which otherwise would be unconditionals. -```C -if ( LOG_DUMPFLAG() { -/* - the code below is only executed if the corresponding - _dump option is set. - */ -LOG_M(............. -LOG_M(............. -log_dump(... -} - -[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/prach.c#L205) -#### matlab format dump -```C -LOG_M(file, vector, data, len, dec, format) -``` -|argument| type| description | -|:-----------|:-------|-----------------:| -| file | char* |path to the fle which will contain the dump | -|vector |char * |name of the dump, printed at the top of the dump file | -|data| void *| pointer to the memory to be dumpped | -|len | int | length of the data to be dumpped, in `dec` unit| -| dec| int | length of each data item.Interpretation depends on format| -|format| int | defines the type of data to be dumped| - -This macro can be used to dump a buffer in a format that can be used for analyze via tools like matlab or octave. **It must be surrounded by LOG_DEBUGFLAG or LOG_DUMPFLAG macros, to prevent the dump to be built unconditionally.** The LOG_M macro points to the `write_file_matlab` function implemented in [log.c](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.c). **This function should be revisited for more understandable implementation and ease of use (format parameter ???)** -[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/PHY/LTE_TRANSPORT/prach.c#L205) - -#### hexadecimal format dump -```C -LOG_DUMPMSG(c, f, b, s, x...) -``` -dumps a memory region if the corresponding debug flag `f` is set as explained here [run time usage page](rtusage.md) - -|argument| type| description | -|:-----------|:-------|-----------------:| -| c | int, component id (in `comp_name_t` enum)| used to print the message, as specified by the s and x arguments | -|f |int |flag used to filter the dump depending on the logs configuration. flag list is defined by the LOG_MASKMAP_INIT macro in [log.h](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.h) | -|b| void *| pointer to the memory to be dumpped | -|s | int | length of the data to be dumpped in char| -| x...| printf format and arguments| text string to be printed at the top of the dump| - -This macro can be used to conditionaly dump a buffer, bytes by bytes, giving the integer value of each byte in hexadecimal form. -[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair2/RRC/LTE/rrc_eNB.c#L1181) - -This macro points to the `log_dump` function, implemented in [log.c](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/common/utils/LOG/log.c). This function can also dump buffers containing `double` data via the LOG_UDUMPMSG macro - -```C -LOG_UDUMPMSG(c, b, s, f, x...) -``` -|argument| type| description | -|:-----------|:-------|-----------------:| -| c | int, component id (in `comp_name_t` enum)| used to print the message, as specified by the s and x arguments | -|b| void *| pointer to the memory to be dumpped | -|s | int | length of the data to be dumpped in char| -|f| int | format of dumped data LOG_DUMP_CHAR or LOG_DUMP_DOUBLE| -| x...| printf format and arguments| text string to be printed at the top of the dump| - -[example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/SIMULATION/LTE_PHY/dlsim.c#L1974) - -### logging facility APIs [logging facility main page](log.md) [oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) From 3df8f96bba15acdef401fdb1fd871024115172b2 Mon Sep 17 00:00:00 2001 From: Francois TABURET Date: Mon, 19 Nov 2018 11:30:54 +0100 Subject: [PATCH 06/10] fix wrong formatting --- common/utils/LOG/DOC/devusage.md | 1 + 1 file changed, 1 insertion(+) diff --git a/common/utils/LOG/DOC/devusage.md b/common/utils/LOG/DOC/devusage.md index 0e68be4414..d7790917fc 100644 --- a/common/utils/LOG/DOC/devusage.md +++ b/common/utils/LOG/DOC/devusage.md @@ -6,6 +6,7 @@ The logging facility objectives are Most developpers will only use the log macros to add console messages to the code. The logging facility also provides an api that is used for initialization and configuration. [Adding console traces in oaicode](addconsoletrace.md) + [Configuring the logging facility](configurelog.md) From 884d4b631d2c4023558ad70b5a605d3a966b22a3 Mon Sep 17 00:00:00 2001 From: Francois TABURET Date: Mon, 19 Nov 2018 11:34:38 +0100 Subject: [PATCH 07/10] fix broken link --- common/utils/LOG/DOC/addconsoletrace.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/utils/LOG/DOC/addconsoletrace.md b/common/utils/LOG/DOC/addconsoletrace.md index 502e9d39d2..d850ac1036 100644 --- a/common/utils/LOG/DOC/addconsoletrace.md +++ b/common/utils/LOG/DOC/addconsoletrace.md @@ -105,6 +105,6 @@ LOG_UDUMPMSG(c, b, s, f, x...) [example in oai code](https://gitlab.eurecom.fr/oai/openairinterface5g/blob/develop/openair1/SIMULATION/LTE_PHY/dlsim.c#L1974) -[logging facility developer main page](ldevusage.md) +[logging facility developer main page](devusage.md) [logging facility main page](log.md) [oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) \ No newline at end of file From 0f0665e9e7f88cb6b9cb1c0cab68b027e0a97276 Mon Sep 17 00:00:00 2001 From: Francois TABURET Date: Mon, 19 Nov 2018 11:35:37 +0100 Subject: [PATCH 08/10] fix broken link --- common/utils/LOG/DOC/configurelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/utils/LOG/DOC/configurelog.md b/common/utils/LOG/DOC/configurelog.md index ee8c0972e6..c671c043bd 100644 --- a/common/utils/LOG/DOC/configurelog.md +++ b/common/utils/LOG/DOC/configurelog.md @@ -44,6 +44,6 @@ Example of using the logging utility APIs can be found, for initialization and c Adding a new component is just adding an item in the `comp_name_t` enum defined in [log.h](../log.h) . You must also declare it in the T Tracer facility [message fefinitions](../../T/T_messages.txt). To add a flag than can then be used for adding conditional code or memory dumps you have to add the flag definition in the `LOG_MASKMAP_INIT` macro, in [log.h](../log.h). -[logging facility developer main page](ldevusage.md) +[logging facility developer main page](devusage.md) [logging facility main page](log.md) [oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) \ No newline at end of file From a86ca815411e8ee9990fbe4d3855f6ba5e097cad Mon Sep 17 00:00:00 2001 From: Francois TABURET Date: Mon, 19 Nov 2018 13:17:23 +0100 Subject: [PATCH 09/10] Update arch.md --- common/utils/LOG/DOC/arch.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/utils/LOG/DOC/arch.md b/common/utils/LOG/DOC/arch.md index 348216983b..a472107d50 100644 --- a/common/utils/LOG/DOC/arch.md +++ b/common/utils/LOG/DOC/arch.md @@ -4,6 +4,9 @@ The oai logging facility is implemented in two source files, located in [common/ 1. [log.c](../log.c) contains logging implementation 1. [log.h](../log.h) is the logging facility include file containing both private and public data type definitions. It also contain API prototypes. +The logging facility doesn't create any thread, all api's are executed in the context of the caller. The tracing macro's LOG_ are all using the logRecord_mt function to output the messages. To keep this function thread safe it must perform a single system call the output stream. The buffer used to build the message must be specific to the calling thread, which is today enforced by using a variable in the logRecord_mt stack. + +Data used by the logging utility are defined by the `log_t` structure which is allocated at init time, when calling the `logInit` function. [logging facility main page](log.md) [oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home) \ No newline at end of file From 117e2a145ef47ae091a05b94b8887ff7d7163285 Mon Sep 17 00:00:00 2001 From: Francois TABURET Date: Mon, 19 Nov 2018 13:20:14 +0100 Subject: [PATCH 10/10] Update arch.md --- common/utils/LOG/DOC/arch.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/utils/LOG/DOC/arch.md b/common/utils/LOG/DOC/arch.md index a472107d50..b9302927be 100644 --- a/common/utils/LOG/DOC/arch.md +++ b/common/utils/LOG/DOC/arch.md @@ -4,7 +4,7 @@ The oai logging facility is implemented in two source files, located in [common/ 1. [log.c](../log.c) contains logging implementation 1. [log.h](../log.h) is the logging facility include file containing both private and public data type definitions. It also contain API prototypes. -The logging facility doesn't create any thread, all api's are executed in the context of the caller. The tracing macro's LOG_ are all using the logRecord_mt function to output the messages. To keep this function thread safe it must perform a single system call the output stream. The buffer used to build the message must be specific to the calling thread, which is today enforced by using a variable in the logRecord_mt stack. +The logging facility doesn't create any thread, all api's are executed in the context of the caller. The tracing macro's `LOG_` are all using the logRecord_mt function to output the messages. To keep this function thread safe it must perform a single system call to the output stream. The buffer used to build the message must be specific to the calling thread, which is today enforced by using a variable in the logRecord_mt stack. Data used by the logging utility are defined by the `log_t` structure which is allocated at init time, when calling the `logInit` function.