logging: Set frontend filters only when filtering enabled

Set initial filtering settings in the log core init only if
runtime filtering is enabled. It saves few bytes when runtime
filtering is off.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruściński 2024-10-07 09:08:13 +02:00 committed by Benjamin Cabé
commit 3f4739834f

View file

@ -257,8 +257,10 @@ void log_core_init(void)
if (IS_ENABLED(CONFIG_LOG_FRONTEND)) {
log_frontend_init();
for (uint16_t s = 0; s < log_src_cnt_get(0); s++) {
log_frontend_filter_set(s, CONFIG_LOG_MAX_LEVEL);
if (IS_ENABLED(CONFIG_LOG_RUNTIME_FILTERING)) {
for (uint16_t s = 0; s < log_src_cnt_get(0); s++) {
log_frontend_filter_set(s, CONFIG_LOG_MAX_LEVEL);
}
}
if (IS_ENABLED(CONFIG_LOG_FRONTEND_ONLY)) {