Do not print NULL module names

Prior to this change, if a module had not registered a name, then the
output would display `(null): `, which was not really helpful. This
change eliminates that by checking if the module name is not NULL prior
to calling the print routines.
reverse-scroll
nirenjan 2021-11-10 09:27:40 -08:00
parent 417641dee0
commit f4a8e7c4d5
1 changed files with 1 additions and 1 deletions

View File

@ -347,7 +347,7 @@ void pinelog_log_message(int module, int level, const char *file, int line, cons
#endif #endif
/* Set the module name if it is not the root */ /* Set the module name if it is not the root */
if (module != PINELOG_MODULE_GLOBAL) { if (module != PINELOG_MODULE_GLOBAL && module_name[module] != NULL) {
#if PINELOG_BUFFER_SZ #if PINELOG_BUFFER_SZ
buf_pos += snprintf(output_buffer + buf_pos, sizeof(output_buffer) - buf_pos, buf_pos += snprintf(output_buffer + buf_pos, sizeof(output_buffer) - buf_pos,
"%s: ", module_name[module]); "%s: ", module_name[module]);