From 0e0a007a2503d468391004c8ea2faae305232345 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Sat, 6 Dec 2014 20:00:08 -0200 Subject: Add configurable per-class log filtering --- src/common/logging/text_formatter.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/common/logging/text_formatter.cpp') diff --git a/src/common/logging/text_formatter.cpp b/src/common/logging/text_formatter.cpp index 88deb150..3fe43534 100644 --- a/src/common/logging/text_formatter.cpp +++ b/src/common/logging/text_formatter.cpp @@ -11,6 +11,7 @@ #endif #include "common/logging/backend.h" +#include "common/logging/filter.h" #include "common/logging/log.h" #include "common/logging/text_formatter.h" @@ -105,7 +106,7 @@ void PrintMessage(const Entry& entry) { fputc('\n', stderr); } -void TextLoggingLoop(std::shared_ptr logger) { +void TextLoggingLoop(std::shared_ptr logger, const Filter* filter) { std::array entry_buffer; while (true) { @@ -114,7 +115,10 @@ void TextLoggingLoop(std::shared_ptr logger) { break; } for (size_t i = 0; i < num_entries; ++i) { - PrintMessage(entry_buffer[i]); + const Entry& entry = entry_buffer[i]; + if (filter->CheckMessage(entry.log_class, entry.log_level)) { + PrintMessage(entry); + } } } } -- cgit v1.2.3