logger: make setFilter match substrings

Allow to filter based on partial tag match
This commit is contained in:
Adrien Béraud committed 2026-01-27 14:29:43 -05:00
1 parent c59c0ef64d
commit 76ae1cd6f2
1 file changed
+3 -3
+3 -3
View File
@@ -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);