mirror of
https://github.com/savoirfairelinux/opendht.git
synced 2026-11-08 12:28:42 +00:00
logger: make setFilter match substrings
Allow to filter based on partial tag match
This commit is contained in:
1 parent
c59c0ef64d
commit
76ae1cd6f2
1 file changed
+3
-3
@@ -135,12 +135,12 @@ struct OPENDHT_PUBLIC Logger
|
||||
return child;
|
||||
}
|
||||
|
||||
void setFilter(std::string_view tag)
|
||||
void setFilter(std::string_view filter)
|
||||
{
|
||||
enable_ = tag.empty() or tag_ == tag;
|
||||
enable_ = filter.empty() or tag_.find(filter) != std::string_view::npos;
|
||||
for (auto it = children_.begin(); it != children_.end();) {
|
||||
if (auto c = it->lock()) {
|
||||
c->setFilter(enable_ ? std::string_view {} : tag);
|
||||
c->setFilter(enable_ ? std::string_view {} : filter);
|
||||
++it;
|
||||
} else {
|
||||
it = children_.erase(it);
|
||||
|
||||
Reference in new issue
Block a user