Skip to content

Commit

Permalink
logging: Allow keeping module names in dedicated section
Browse files Browse the repository at this point in the history
When CONFIG_LOG_FMT_SECTION is enabled then module name strings
are also placed in the dedicated section used for all logging
strings.

Signed-off-by: Krzysztof Chruściński <[email protected]>
  • Loading branch information
nordic-krch authored and carlescufi committed Oct 27, 2023
1 parent 9470e3d commit 78bf8eb
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions include/zephyr/logging/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,19 @@ void z_log_vprintk(const char *fmt, va_list ap);
/* Return first argument */
#define _LOG_ARG1(arg1, ...) arg1

#define _LOG_MODULE_CONST_DATA_CREATE(_name, _level) \
IF_ENABLED(LOG_IN_CPLUSPLUS, (extern)) \
const STRUCT_SECTION_ITERABLE_ALTERNATE(log_const, \
log_source_const_data, \
Z_LOG_ITEM_CONST_DATA(_name)) = \
{ \
.name = STRINGIFY(_name), \
.level = _level \
#define _LOG_MODULE_CONST_DATA_CREATE(_name, _level) \
IF_ENABLED(CONFIG_LOG_FMT_SECTION, ( \
static const char UTIL_CAT(_name, _str)[] \
__in_section(_log_strings, static, _CONCAT(_name, _)) __used __noasan = \
STRINGIFY(_name);)) \
IF_ENABLED(LOG_IN_CPLUSPLUS, (extern)) \
const STRUCT_SECTION_ITERABLE_ALTERNATE(log_const, \
log_source_const_data, \
Z_LOG_ITEM_CONST_DATA(_name)) = \
{ \
.name = COND_CODE_1(CONFIG_LOG_FMT_SECTION, \
(UTIL_CAT(_name, _str)), (STRINGIFY(_name))), \
.level = _level \
}

#define _LOG_MODULE_DYNAMIC_DATA_CREATE(_name) \
Expand Down

0 comments on commit 78bf8eb

Please sign in to comment.