logging: refactor log_filter_set to set existing log level

Modified log_filter_set function to limit level if requested
level is not compiled in. Additionally, extended function to
return actually set level. Removed redundant code from log_cmds.

Change fixes shell log backend initialization which was setting
log levels without taking into account compiled in limits.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2018-11-16 14:33:29 +01:00 committed by Anas Nashif
commit e85986e153
3 changed files with 29 additions and 28 deletions

View file

@ -134,15 +134,18 @@ u32_t log_filter_get(struct log_backend const *const backend,
/**
* @brief Set filter on given source for the provided backend.
*
* @param backend Backend instance.
* @param backend Backend instance. NULL for all backends.
* @param domain_id ID of the domain.
* @param src_id Source (module or instance) ID.
* @param level Severity level.
*
* @return Actual level set which may be limited by compiled level. If filter
* was set for all backends then maximal level that was set is returned.
*/
void log_filter_set(struct log_backend const *const backend,
u32_t domain_id,
u32_t src_id,
u32_t level);
u32_t log_filter_set(struct log_backend const *const backend,
u32_t domain_id,
u32_t src_id,
u32_t level);
/**
*