-
Notifications
You must be signed in to change notification settings - Fork 7.5k
logging: add template for log configuration #9933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
logging: add template for log configuration #9933
Conversation
fyi @Olivier-ProGlove @jhedberg @jukkar see the example how log configuration can be established in each module: |
1d8b49e
to
f9dda4e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be split to two commits? The first one would add the template, and the second one would add the sample that shows how to use it.
f9dda4e
to
f40bac7
Compare
@jukkar done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Codecov Report
@@ Coverage Diff @@
## master #9933 +/- ##
=======================================
Coverage 52.51% 52.51%
=======================================
Files 213 213
Lines 26082 26082
Branches 5624 5624
=======================================
Hits 13696 13696
Misses 10135 10135
Partials 2251 2251 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, Will add @ulfalizer to review too.
I have been porting this to networking logging code and was wondering if something like this would be possible (ping @ulfalizer) : Kconfig:
Kconfig.log_level_template:
Current code outputs the help text just plain "$(module-help)" instead of expected help text. |
menu "Application configuration" | ||
|
||
module=SAMPLE_MODULE | ||
module-str=Sample module |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would look less cramped with spaces around the =
. Assignments work like in Make, so leading spaces are stripped automatically.
No macro expansion is done in help texts, so not currently possible. I wonder if it would break stuff in case help texts talk about Make variables, though that's unlikely in Zephyr. Do you think making a reference to the prompt would be possible in the meantime, or making it generic ("enables some-feature for the subsystem" or the like)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we have documentation how this template can be used and will be used?
good point. it is work updating the documentation. |
This is great. Just a minor comment, should we settle on an extension for Kconfig templates? I would perhaps suggest “.ktemplate” |
@carlescufi would you propose renaming file to log_config.ktemplate ? |
Actually looking at what we do today: |
@carlescufi maybe |
Sounds good to me. |
Added Kconfig.log_template file with template for module log configuration. Signed-off-by: Krzysztof Chruscinski <[email protected]>
Logger sample extended to use template for configuration of sample module. Signed-off-by: Krzysztof Chruscinski <[email protected]>
f40bac7
to
76ab11c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doc change looks OK.
Added Kconfig template file to be used when log configuration
in a module is added. Added example usage of kconfig template
in logger sample.
It is using new kconfig feature added in: #9797 (issue #9761)
Signed-off-by: Krzysztof Chruscinski [email protected]