Skip to content

make: add LOG_LEVEL to overridable variables#11592

Merged
aabadie merged 1 commit intoRIOT-OS:masterfrom
aabadie:pr/make/log_level_var
May 29, 2019
Merged

make: add LOG_LEVEL to overridable variables#11592
aabadie merged 1 commit intoRIOT-OS:masterfrom
aabadie:pr/make/log_level_var

Conversation

@aabadie
Copy link
Copy Markdown
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
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
Copy Markdown
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
endif

# If not already set in CFLAGS, set logging level by default to INFO, e.g. 3.
LOG_LEVEL ?= 3
Copy link
Copy Markdown
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
Copy Markdown
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
@aabadie aabadie force-pushed the pr/make/log_level_var branch from ebb3a4f to cfc19bf Compare May 28, 2019 14:51
@aabadie aabadie force-pushed the pr/make/log_level_var branch from be4f265 to 52d774a Compare May 28, 2019 20:21
@aabadie aabadie force-pushed the pr/make/log_level_var branch from 52d774a to 166ed18 Compare May 28, 2019 20:49
@aabadie
Copy link
Copy Markdown
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.

2 participants