logging: Fix fail when log locally disabled

When log is locally disabled then structures associated with the module
are not created. Logger API macros were evaluating those structues even
when log was disabled for given module. That resulted in compilation
error. Macros has been improved to not touch those structures when
log is disabled for given module.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2018-07-11 08:56:54 +02:00 committed by Anas Nashif
commit 67d6987324
3 changed files with 58 additions and 47 deletions

View file

@ -256,9 +256,7 @@ int log_printk(const char *fmt, va_list ap);
* - Instance logging is used and there is no need to create module entry.
*/
#if defined(LOG_MODULE_NAME) && \
((defined(LOG_LEVEL) && (LOG_LEVEL > LOG_LEVEL_NONE)) || \
(!defined(LOG_LEVEL) && (CONFIG_LOG_DEFAULT_LEVEL > LOG_LEVEL_NONE)))
#if LOG_MODULE_PRESENT
#if CONFIG_LOG_RUNTIME_FILTERING
#define LOG_MODULE_REGISTER() \
_LOG_CONST_ITEM_REGISTER(LOG_MODULE_NAME, \
@ -279,9 +277,9 @@ int log_printk(const char *fmt, va_list ap);
CONFIG_LOG_DEFAULT_LEVEL))
#endif /*CONFIG_LOG_RUNTIME_FILTERING*/
#else /* LOG enabled for the module. */
#else /* LOG_MODULE_PRESENT */
#define LOG_MODULE_REGISTER() /* Empty */
#endif
#endif /* LOG_MODULE_PRESENT */
/**
* @}