Logging: Add Kconfig template for log inheriting
Add a new Kconfig template that allow log modules to inherit their log level from their parent module. For example, the logs used in the Bluetooth audio like `BT_AUDIO_STREAM_LOG_LEVEL` can inherit their level from `BT_AUDIO_LOG_LEVEL`. Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
This commit is contained in:
parent
2cee5ff519
commit
ff5b8f003e
1 changed files with 27 additions and 0 deletions
27
subsys/logging/Kconfig.template.log_config_inherit
Normal file
27
subsys/logging/Kconfig.template.log_config_inherit
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# Copyright (c) 2022 Nordic Semicoductor ASA
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
# Usage:
|
||||||
|
# This template allow module to use the parent module log level by default.
|
||||||
|
#
|
||||||
|
# The following arguments are mandatory:
|
||||||
|
# - module:
|
||||||
|
# Name of the new log module.
|
||||||
|
# Example: "BT_HCI_CORE"
|
||||||
|
# - parent-module:
|
||||||
|
# Name of the module that will be inherited by the new module.
|
||||||
|
# Example: "BT"
|
||||||
|
|
||||||
|
choice "$(module)_LOG_LEVEL_CHOICE"
|
||||||
|
default $(module)_LOG_LEVEL_INHERIT if y
|
||||||
|
|
||||||
|
config $(module)_LOG_LEVEL_INHERIT
|
||||||
|
bool "Inherit $(parent-module)_LOG_LEVEL"
|
||||||
|
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
config $(module)_LOG_LEVEL
|
||||||
|
default $(parent-module)_LOG_LEVEL if $(module)_LOG_LEVEL_INHERIT
|
||||||
|
|
||||||
|
module := $(module)
|
||||||
|
source "subsys/logging/Kconfig.template.log_config"
|
Loading…
Add table
Add a link
Reference in a new issue