diff options
author | Sean Anderson <seanga2@gmail.com> | 2020-10-28 02:55:30 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-10-30 17:55:26 +0300 |
commit | 40455a6915e1f08e74a71d5c859ef93b6d815899 (patch) | |
tree | c23e154c70eefef29d43f0bbe439777261bd3fc4 /common | |
parent | f51e5ec4d7ebb6be110ef20eda6e000a04695221 (diff) | |
download | u-boot-40455a6915e1f08e74a71d5c859ef93b6d815899.tar.xz |
log: Add filter flag to match greater than a log level
This is the complement of the existing behavior to match only messages with
a log level less than a threshold. This is primarily useful in conjunction
with LOGFF_DENY.
Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/log.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/common/log.c b/common/log.c index c1b6b6105f..4b6f3fcd04 100644 --- a/common/log.c +++ b/common/log.c @@ -162,11 +162,17 @@ static bool log_passes_filters(struct log_device *ldev, struct log_rec *rec) } list_for_each_entry(filt, &ldev->filter_head, sibling_node) { - if (rec->level > filt->max_level) + if (filt->flags & LOGFF_LEVEL_MIN) { + if (rec->level < filt->level) + continue; + } else if (rec->level > filt->level) { continue; + } + if ((filt->flags & LOGFF_HAS_CAT) && !log_has_cat(filt->cat_list, rec->cat)) continue; + if (filt->file_list && !log_has_file(filt->file_list, rec->file)) continue; @@ -251,7 +257,7 @@ int _log(enum log_category_t cat, enum log_level_t level, const char *file, } int log_add_filter_flags(const char *drv_name, enum log_category_t cat_list[], - enum log_level_t max_level, const char *file_list, + enum log_level_t level, const char *file_list, int flags) { struct log_filter *filt; @@ -279,7 +285,7 @@ int log_add_filter_flags(const char *drv_name, enum log_category_t cat_list[], break; } } - filt->max_level = max_level; + filt->level = level; if (file_list) { filt->file_list = strdup(file_list); if (!filt->file_list) { |