configurelog.md 2.25 KB

Initializing and configuring the logging facility

logging facility APIs

int  logInit (void);

Allocate the internal data used by the logging utility, set the configuration, using the configuration module

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.

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.

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.

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.

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 and in the telnet server log command implementation 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 . You must also declare it in the T Tracer facility message fefinitions. 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.

logging facility developer main page logging facility main page oai Wikis home