[PATCH 2/5] log: Refactor log level text output

Torsten Hilbrich torsten.hilbrich at secunet.com
Tue May 30 05:41:50 UTC 2017


Am 29.05.2017 um 13:28 schrieb Aleksander Morgado:
> Hey Torsten,
> 
[...]
> 
>> +{
>> +    switch (level) {
>> +    case LOGL_DEBUG:
>> +        return "debug";
>> +    case LOGL_WARN:
>> +        return "warn";
>> +    case LOGL_INFO:
>> +        return "info";
>> +    case LOGL_ERR:
>> +        return "error";
>> +    }
>> +    /* this should not happen as all valid enum values are supported
>> +       above */
>> +    return "unknown";
> 
> How about this better?
>   g_assert_not_reached();
>   return NULL;

I will change it this way.

[...]
> Before this patch all the level message strings were aligned; e.g.:
> 
>  <info>  something
>  <debug> something else
> 
> The <info> and <warn> items had an extra whitespace to have that. Can we still have that with this cleanup? We could just have log_level_description() return the full "<xxxx> " string, with trailing whitespaces (1 or 2) included.

Removing the same indent was not my intention, I will fix this.

	Torsten


More information about the ModemManager-devel mailing list