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
make: add LOG_LEVEL to overridable variables #11592
Conversation
makefiles/vars.inc.mk
Outdated
@@ -95,3 +95,5 @@ export UNZIP_HERE # Use `cd $(SOME_FOLDER) && $(UNZIP_HERE) $(SOME_FI | |||
|
|||
export LAZYSPONGE # Command saving stdin to a file only on content update. | |||
export LAZYSPONGE_FLAGS # Parameters supplied to LAZYSPONGE. | |||
|
|||
# LOG_LEVEL # Logging level (NONE: 0, ERROR: 1, WARNING: 2, INFO: 3, DEBUG: 4, default: 3) |
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.
This might be ambiguous. This could be read, that log levels are to be given as words. Maybe write
# LOG_LEVEL # Logging level (NONE: 0, ERROR: 1, WARNING: 2, INFO: 3, DEBUG: 4, default: 3) | |
# LOG_LEVEL # Logging level as integer (NONE: 0, ERROR: 1, WARNING: 2, INFO: 3, DEBUG: 4, default: 3) |
Makefile.include
Outdated
@@ -141,6 +141,12 @@ ifeq ($(DEVELHELP),1) | |||
CFLAGS += -DDEVELHELP | |||
endif | |||
|
|||
# If not already set in CFLAGS, set logging level by default to INFO, e.g. 3. | |||
LOG_LEVEL ?= 3 |
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.
Why not leave it unset and check if it is set as default? This way in case we want to change the default we don't have to do it in three places (here, the doc in vars.inc.mk
, and the define) and confusions for a person trying to change just the define are avoided.
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.
Ok, I changed it this way.
ebb3a4f
to
cfc19bf
Compare
be4f265
to
52d774a
Compare
52d774a
to
166ed18
Compare
All green, let's go! |
Contribution description
This PR allows to set the logging level via a make variable instead of having to explicitly set this via CFLAGS. Example:
With this PR, one can use
LOG_LEVEL=4 make -C <application dir>
to enable debug log level instead of CFLAGS=-DLOG_LEVEL=4 make -CIf an application already set the log level via CFLAGS, then this variable is ignored.
Testing procedure
One can try to disable logging by using LOG_LEVEL=0 in any application an notice that the
This is RIOT!
welcome message is not displayed at any application startup.Issues/PRs references
Idea raised by @miri64 in #11573 (see #11573 (comment))