Skip to content

Commit 76ab11c

Browse files
committed
samples: subsys: logging: example of kconfig.log_template usage
Logger sample extended to use template for configuration of sample module. Signed-off-by: Krzysztof Chruscinski <[email protected]>
1 parent 0137ecd commit 76ab11c

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

samples/subsys/logging/logger/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
cmake_minimum_required(VERSION 3.8.2)
22

3+
set(KCONFIG_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/Kconfig)
4+
35
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
46
project(NONE)
57

samples/subsys/logging/logger/Kconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Kconfig - Config options for logger sample app
2+
#
3+
# Copyright (c) 2018 Nordic Semiconductor ASA
4+
#
5+
# SPDX-License-Identifier: Apache-2.0
6+
#
7+
8+
mainmenu "Logger sample application"
9+
10+
menu "Application configuration"
11+
12+
module = SAMPLE_MODULE
13+
module-str = Sample module
14+
source "subsys/logging/Kconfig.template.log_config"
15+
16+
endmenu
17+
18+
source "$(ZEPHYR_BASE)/Kconfig.zephyr"

samples/subsys/logging/logger/src/sample_module.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66
#include <zephyr.h>
7-
8-
#define LOG_MODULE_NAME foo
97
#include <logging/log.h>
108

9+
#define LOG_MODULE_NAME sample_module
10+
#define LOG_LEVEL CONFIG_SAMPLE_MODULE_LOG_LEVEL
1111
LOG_MODULE_REGISTER(LOG_MODULE_NAME);
1212

1313
const char *sample_module_name_get(void)

0 commit comments

Comments
 (0)