[dpdk-dev] [PATCH v3 07/11] eal: add log level help

Kinsella, Ray mdr at ashroe.eu
Mon Mar 15 11:42:57 CET 2021



On 15/03/2021 10:31, Bruce Richardson wrote:
> On Mon, Mar 15, 2021 at 10:19:47AM +0000, Kinsella, Ray wrote:
>>
>>
>> On 12/03/2021 18:17, Thomas Monjalon wrote:
>>> The option --log-level was not completely described in the usage text,
>>> and it was difficult to guess the names of the log types and levels.
>>>
>>> A new value "help" is accepted after --log-level to give more details
>>> about the syntax and listing the log types and levels.
>>>
>>> The array "levels" used for level name parsing is replaced with
>>> a (modified) existing function which was used in rte_log_dump().
>>>
>>> The new function rte_log_list_types() is exported in the API
>>> for allowing an application to give this info to the user
>>> if not exposing the EAL option --log-level.
>>> The list of log types cannot include all drivers if not linked in the
>>> application (shared object plugin case).
>>>
>>> Signed-off-by: Thomas Monjalon <thomas at monjalon.net>
>>> ---
>>>  lib/librte_eal/common/eal_common_log.c     | 24 +++++++++---
>>>  lib/librte_eal/common/eal_common_options.c | 44 +++++++++++++++-------
>>>  lib/librte_eal/common/eal_log.h            |  5 +++
>>>  lib/librte_eal/include/rte_log.h           | 11 ++++++
>>>  lib/librte_eal/version.map                 |  3 ++
>>>  5 files changed, 69 insertions(+), 18 deletions(-)
>>>
> <snip>
>>> @@ -1274,6 +1286,11 @@ eal_parse_log_level(const char *arg)
>>>  	char *str, *level;
>>>  	int priority;
>>>  
>>> +	if (strcmp(arg, "help") == 0) {
>>
>> So I think the convention is to support both "?" and "help".
>> Qemu does this at least. 
>>
> I've seen "/?" used for help on windows binaries, but "-?" not so much in the
> linux world, where --help (and often -h for short) seem to be the standard.
> 

This is slightly different - it is where you are looking to return a list of valid 
values for a parameter. So for instance in qemu mentioned above 

 ~ > qemu-system-x86_64 -cpu ? | head -n 10
Available CPUs:
x86 486                   (alias configured by machine type)
x86 486-v1
x86 Broadwell             (alias configured by machine type)
x86 Broadwell-IBRS        (alias of Broadwell-v3)
x86 Broadwell-noTSX       (alias of Broadwell-v2)
x86 Broadwell-noTSX-IBRS  (alias of Broadwell-v4)
x86 Broadwell-v1          Intel Core Processor (Broadwell)
x86 Broadwell-v2          Intel Core Processor (Broadwell, no TSX)
x86 Broadwell-v3          Intel Core Processor (Broadwell, IBRS)





More information about the dev mailing list