aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/common/logging/filter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/logging/filter.cpp')
-rw-r--r--src/common/logging/filter.cpp41
1 files changed, 4 insertions, 37 deletions
diff --git a/src/common/logging/filter.cpp b/src/common/logging/filter.cpp
index 50f2e13f..55cc8888 100644
--- a/src/common/logging/filter.cpp
+++ b/src/common/logging/filter.cpp
@@ -22,16 +22,6 @@ void Filter::SetClassLevel(Class log_class, Level level) {
class_levels[static_cast<size_t>(log_class)] = level;
}
-void Filter::SetSubclassesLevel(const ClassInfo& log_class, Level level) {
- const size_t log_class_i = static_cast<size_t>(log_class.log_class);
-
- const size_t begin = log_class_i + 1;
- const size_t end = begin + log_class.num_children;
- for (size_t i = begin; begin < end; ++i) {
- class_levels[i] = level;
- }
-}
-
void Filter::ParseFilterString(const std::string& filter_str) {
auto clause_begin = filter_str.cbegin();
while (clause_begin != filter_str.cend()) {
@@ -53,7 +43,7 @@ void Filter::ParseFilterString(const std::string& filter_str) {
template <typename It>
static Level GetLevelByName(const It begin, const It end) {
for (u8 i = 0; i < static_cast<u8>(Level::Count); ++i) {
- const char* level_name = Logger::GetLevelName(static_cast<Level>(i));
+ const char* level_name = GetLevelName(static_cast<Level>(i));
if (Common::ComparePartialString(begin, end, level_name)) {
return static_cast<Level>(i);
}
@@ -64,7 +54,7 @@ static Level GetLevelByName(const It begin, const It end) {
template <typename It>
static Class GetClassByName(const It begin, const It end) {
for (ClassType i = 0; i < static_cast<ClassType>(Class::Count); ++i) {
- const char* level_name = Logger::GetLogClassName(static_cast<Class>(i));
+ const char* level_name = GetLogClassName(static_cast<Class>(i));
if (Common::ComparePartialString(begin, end, level_name)) {
return static_cast<Class>(i);
}
@@ -72,20 +62,6 @@ static Class GetClassByName(const It begin, const It end) {
return Class::Count;
}
-template <typename InputIt, typename T>
-static InputIt find_last(InputIt begin, const InputIt end, const T& value) {
- auto match = end;
- while (begin != end) {
- auto new_match = std::find(begin, end, value);
- if (new_match != end) {
- match = new_match;
- ++new_match;
- }
- begin = new_match;
- }
- return match;
-}
-
bool Filter::ParseFilterRule(const std::string::const_iterator begin,
const std::string::const_iterator end) {
auto level_separator = std::find(begin, end, ':');
@@ -106,22 +82,13 @@ bool Filter::ParseFilterRule(const std::string::const_iterator begin,
return true;
}
- auto class_name_end = find_last(begin, level_separator, '.');
- if (class_name_end != level_separator &&
- !Common::ComparePartialString(class_name_end + 1, level_separator, "*")) {
- class_name_end = level_separator;
- }
-
- const Class log_class = GetClassByName(begin, class_name_end);
+ const Class log_class = GetClassByName(begin, level_separator);
if (log_class == Class::Count) {
LOG_ERROR(Log, "Unknown log class in filter: %s", std::string(begin, end).c_str());
return false;
}
- if (class_name_end == level_separator) {
- SetClassLevel(log_class, level);
- }
- SetSubclassesLevel(log_class, level);
+ SetClassLevel(log_class, level);
return true;
}