logs: Add manual set log level with RegEx

This commit is contained in:
Eladash 2023-07-09 10:35:18 +03:00 committed by Elad Ashkenazi
parent a98174be85
commit e76ce05e29

View File

@ -11,6 +11,7 @@
#include <chrono>
#include <cstring>
#include <cerrno>
#include <regex>
using namespace std::literals::chrono_literals;
@ -211,6 +212,24 @@ namespace logs
{
std::lock_guard lock(g_mutex);
if (ch_name.find_first_of(".+*?^$()[]{}|\\") != umax)
{
const std::regex ex(ch_name);
// RegEx pattern
for (auto& channel_pair : get_logger()->channels)
{
std::smatch sm;
if (std::regex_match(channel_pair.first, sm, ex))
{
channel_pair.second->enabled.release(value);
}
}
return;
}
auto found = get_logger()->channels.equal_range(ch_name);
while (found.first != found.second)