log: clean up Kconfig
LOG_DEFAULT_LEVEL has been chosen as 6. Adjust the default of LOG_MAX_LEVEL
to this value.
Use ranges to clamp log levels to reasonable values.
Group output options by main U-Boot, SPL, TPL, followed by other logging
options.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/common/Kconfig b/common/Kconfig
index 2d86dd7..7872bc4 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -647,28 +647,12 @@
discarded if not needed. Logging supports various categories and
levels of severity.
-config SPL_LOG
- bool "Enable logging support in SPL"
- depends on LOG
- help
- This enables support for logging of status and debug messages. These
- can be displayed on the console, recorded in a memory buffer, or
- discarded if not needed. Logging supports various categories and
- levels of severity.
-
-config TPL_LOG
- bool "Enable logging support in TPL"
- depends on LOG
- help
- This enables support for logging of status and debug messages. These
- can be displayed on the console, recorded in a memory buffer, or
- discarded if not needed. Logging supports various categories and
- levels of severity.
+if LOG
config LOG_MAX_LEVEL
int "Maximum log level to record"
- depends on LOG
- default 5
+ default 6
+ range 0 9
help
This selects the maximum log level that will be recorded. Any value
higher than this will be ignored. If possible log statements below
@@ -685,14 +669,15 @@
8 - debug content
9 - debug hardware I/O
-config SPL_LOG_MAX_LEVEL
- int "Maximum log level to record in SPL"
- depends on SPL_LOG
- default 3
+config LOG_DEFAULT_LEVEL
+ int "Default logging level to display"
+ default LOG_MAX_LEVEL
+ range 0 LOG_MAX_LEVEL
help
- This selects the maximum log level that will be recorded. Any value
- higher than this will be ignored. If possible log statements below
- this level will be discarded at build time. Levels:
+ This is the default logging level set when U-Boot starts. It can
+ be adjusted later using the 'log level' command. Note that setting
+ this to a value above LOG_MAX_LEVEL will be ineffective, since the
+ higher levels are not compiled in to U-Boot.
0 - emergency
1 - alert
@@ -705,10 +690,38 @@
8 - debug content
9 - debug hardware I/O
-config TPL_LOG_MAX_LEVEL
- int "Maximum log level to record in TPL"
- depends on TPL_LOG
+config LOG_CONSOLE
+ bool "Allow log output to the console"
+ default y
+ help
+ Enables a log driver which writes log records to the console.
+ Generally the console is the serial port or LCD display. Only the
+ log message is shown - other details like level, category, file and
+ line number are omitted.
+
+config LOG_SYSLOG
+ bool "Log output to syslog server"
+ depends on NET
+ help
+ Enables a log driver which broadcasts log records via UDP port 514
+ to syslog servers.
+
+config SPL_LOG
+ bool "Enable logging support in SPL"
+ depends on LOG
+ help
+ This enables support for logging of status and debug messages. These
+ can be displayed on the console, recorded in a memory buffer, or
+ discarded if not needed. Logging supports various categories and
+ levels of severity.
+
+if SPL_LOG
+
+config SPL_LOG_MAX_LEVEL
+ int "Maximum log level to record in SPL"
+ depends on SPL_LOG
default 3
+ range 0 9
help
This selects the maximum log level that will be recorded. Any value
higher than this will be ignored. If possible log statements below
@@ -725,14 +738,37 @@
8 - debug content
9 - debug hardware I/O
-config LOG_DEFAULT_LEVEL
- int "Default logging level to display"
- default 6
+config SPL_LOG_CONSOLE
+ bool "Allow log output to the console in SPL"
+ default y
help
- This is the default logging level set when U-Boot starts. It can
- be adjusted later using the 'log level' command. Note that setting
- this to a value above LOG_MAX_LEVEL will be ineffective, since the
- higher levels are not compiled in to U-Boot.
+ Enables a log driver which writes log records to the console.
+ Generally the console is the serial port or LCD display. Only the
+ log message is shown - other details like level, category, file and
+ line number are omitted.
+
+endif
+
+config TPL_LOG
+ bool "Enable logging support in TPL"
+ depends on LOG
+ help
+ This enables support for logging of status and debug messages. These
+ can be displayed on the console, recorded in a memory buffer, or
+ discarded if not needed. Logging supports various categories and
+ levels of severity.
+
+if TPL_LOG
+
+config TPL_LOG_MAX_LEVEL
+ int "Maximum log level to record in TPL"
+ depends on TPL_LOG
+ default 3
+ range 0 9
+ help
+ This selects the maximum log level that will be recorded. Any value
+ higher than this will be ignored. If possible log statements below
+ this level will be discarded at build time. Levels:
0 - emergency
1 - alert
@@ -745,29 +781,8 @@
8 - debug content
9 - debug hardware I/O
-config LOG_CONSOLE
- bool "Allow log output to the console"
- depends on LOG
- default y
- help
- Enables a log driver which writes log records to the console.
- Generally the console is the serial port or LCD display. Only the
- log message is shown - other details like level, category, file and
- line number are omitted.
-
-config SPL_LOG_CONSOLE
- bool "Allow log output to the console in SPL"
- depends on SPL_LOG
- default y
- help
- Enables a log driver which writes log records to the console.
- Generally the console is the serial port or LCD display. Only the
- log message is shown - other details like level, category, file and
- line number are omitted.
-
config TPL_LOG_CONSOLE
bool "Allow log output to the console in TPL"
- depends on TPL_LOG
default y
help
Enables a log driver which writes log records to the console.
@@ -775,26 +790,10 @@
log message is shown - other details like level, category, file and
line number are omitted.
-config LOG_SYSLOG
- bool "Log output to syslog server"
- depends on LOG && NET
- help
- Enables a log driver which broadcasts log records via UDP port 514
- to syslog servers.
-
-config LOG_TEST
- bool "Provide a test for logging"
- depends on LOG && UNIT_TEST
- default y if SANDBOX
- help
- This enables a 'log test' command to test logging. It is normally
- executed from a pytest and simply outputs logging information
- in various different ways to test that the logging system works
- correctly with various settings.
+endif
config LOG_ERROR_RETURN
bool "Log all functions which return an error"
- depends on LOG
help
When an error is returned in U-Boot it is sometimes difficult to
figure out the root cause. For example, reading from SPI flash may
@@ -805,6 +804,18 @@
You can add log_ret() to all functions which return an error code.
+config LOG_TEST
+ bool "Provide a test for logging"
+ depends on UNIT_TEST
+ default y if SANDBOX
+ help
+ This enables a 'log test' command to test logging. It is normally
+ executed from a pytest and simply outputs logging information
+ in various different ways to test that the logging system works
+ correctly with various settings.
+
+endif
+
endmenu
config SUPPORT_RAW_INITRD