Extend the logging module to support custom module prefix
This commit is contained in:
parent
0e93d1da9c
commit
11b50009e9
@ -81,6 +81,13 @@
|
||||
#define LOG_OUTPUT(...) printf(__VA_ARGS__)
|
||||
#endif /* LOG_CONF_OUTPUT */
|
||||
|
||||
/* Custom log prefix output function -- default is LOG_OUTPUT */
|
||||
#ifdef LOG_CONF_OUTPUT_PREFIX
|
||||
#define LOG_OUTPUT_PREFIX(level, levelstr, module) LOG_CONF_OUTPUT_PREFIX(level, levelstr, module)
|
||||
#else /* LOG_CONF_OUTPUT_PREFIX */
|
||||
#define LOG_OUTPUT_PREFIX(level, levelstr, module) LOG_OUTPUT("[%-4s: %-10s] ", levelstr, module)
|
||||
#endif /* LOG_CONF_OUTPUT_PREFIX */
|
||||
|
||||
/******************************************************************************/
|
||||
/********************* A list of currently supported modules ******************/
|
||||
/******************************************************************************/
|
||||
|
@ -101,7 +101,7 @@ extern struct log_module all_modules[];
|
||||
if(level <= (LOG_LEVEL)) { \
|
||||
if(newline) { \
|
||||
if(LOG_WITH_MODULE_PREFIX) { \
|
||||
LOG_OUTPUT("[%-4s: %-10s] ", levelstr, LOG_MODULE); \
|
||||
LOG_OUTPUT_PREFIX(level, levelstr, LOG_MODULE); \
|
||||
} \
|
||||
if(LOG_WITH_LOC) { \
|
||||
LOG_OUTPUT("[%s: %d] ", __FILE__, __LINE__); \
|
||||
|
Loading…
Reference in New Issue
Block a user