Skip to content
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

Merged
merged 1 commit into from May 29, 2019

Conversation

aabadie
Copy link
Contributor

@aabadie aabadie commented May 28, 2019

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 -C

If 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))

@aabadie aabadie added Area: build system Area: Build system CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels May 28, 2019
@aabadie aabadie requested a review from miri64 May 28, 2019 08:52
@@ -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)
Copy link
Member

@miri64 miri64 May 28, 2019

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

Suggested change
# 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
Copy link
Member

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.

Copy link
Contributor Author

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.

@miri64 miri64 added the Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation label May 28, 2019
Makefile.include Show resolved Hide resolved
Makefile.include Show resolved Hide resolved
@aabadie
Copy link
Contributor Author

aabadie commented May 29, 2019

All green, let's go!

@aabadie aabadie merged commit ab4bf18 into RIOT-OS:master May 29, 2019
@aabadie aabadie deleted the pr/make/log_level_var branch May 29, 2019 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: build system Area: Build system CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants