[dpdk-dev] [PATCH] log: add API to check if a logtype can log in a given level

Ferruh Yigit ferruh.yigit at intel.com
Tue Mar 3 17:15:41 CET 2020


On 3/3/2020 4:02 PM, Stephen Hemminger wrote:
> On Tue,  3 Mar 2020 13:25:12 +0000
> Ferruh Yigit <ferruh.yigit at intel.com> wrote:
> 
>>  
>> +int
>> +rte_log_can_log(uint32_t logtype, uint32_t level)
>> +{
>> +	int log_level;
>> +
>> +	if (level > rte_log_get_global_level())
>> +		return 0;
>> +
>> +	log_level = rte_log_get_level(logtype);
>> +	if (log_level < 0)
>> +		return 0;
>> +
>> +	if (level > (uint32_t)log_level)
>> +		return 0;
>> +
>> +	return 1;
>> +}
> 
> Why not use a boolean (stdbool) for return value?
> 

No specific reason, but agree functions suits the bool, I will send a v2.


More information about the dev mailing list