HI Eugen,

On Fri, Feb 09, 2018 at 01:28:45PM +0100, Eugen Wiens wrote:
> When the system is booting the warnings and errors are not be quickly 
> discovered.
> With this improvement the errors are colored red, the warnings yellow and the 
> notices blue.

I like this because I like colors ;)
However, some people do not. Can we make this honour the value of the
global.allow_color variable? This variable is currently only used in the
environment, so we would have to move it to C code by adding a
globalvar_add_simple_bool().

> 
> Signed-off-by: Eugen Wiens <eugen.wi...@jumo.net>
> ---
>  common/Kconfig          |  8 ++++++++
>  common/console_common.c | 29 ++++++++++++++++++++++++++++-
>  2 files changed, 36 insertions(+), 1 deletion(-)
> 
> diff --git a/common/Kconfig b/common/Kconfig
> index 57418ca..461ad35 100644
> --- a/common/Kconfig
> +++ b/common/Kconfig
> @@ -1000,6 +1000,14 @@ config DEFAULT_LOGLEVEL
>         7    debug-level messages (debug)
>         8    verbose debug messages (vdebug)
>  
> +config PRINT_COLORED_LOG_LEVEL
> +     prompt "enable colored printing of the log level"
> +     bool
> +     default n
> +     help
> +             Enable the print out of the colored log level.

I don't think it's worth having an extra config option for this.
If we get concerned about the code size, then we should rather
add a global color control Kconfig option and let everything color
related depend on this.

Something like:

config CONSOLE_ALLOW_COLOR
        prompt "Allow colored console output"
        bool

static unsigned int allow_color;

bool __console_allow_color(void)
{
        return allow_color;
}

Some initcall:
        globalvar_add_simple_bool("allow_color", &allow_color);

include/:

static inline bool console_allow_color(void)
{
        if (!IS_ENABLED(CONFIG_CONSOLE_ALLOW_COLOR))
                return false;
        return __console_allow_color();
}

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to