summaryrefslogtreecommitdiff
path: root/src/common/logging/text_formatter.cpp
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2014-12-06 20:00:08 -0200
committerGravatar Yuri Kunde Schlesner2014-12-13 02:08:06 -0200
commit0e0a007a2503d468391004c8ea2faae305232345 (patch)
tree75feea527bd46aa4c534b77b560c89d538757f7f /src/common/logging/text_formatter.cpp
parentConvert old logging calls to new logging macros (diff)
downloadyuzu-0e0a007a2503d468391004c8ea2faae305232345.tar.gz
yuzu-0e0a007a2503d468391004c8ea2faae305232345.tar.xz
yuzu-0e0a007a2503d468391004c8ea2faae305232345.zip
Add configurable per-class log filtering
Diffstat (limited to 'src/common/logging/text_formatter.cpp')
-rw-r--r--src/common/logging/text_formatter.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/common/logging/text_formatter.cpp b/src/common/logging/text_formatter.cpp
index 88deb150e..3fe435346 100644
--- a/src/common/logging/text_formatter.cpp
+++ b/src/common/logging/text_formatter.cpp
@@ -11,6 +11,7 @@
11#endif 11#endif
12 12
13#include "common/logging/backend.h" 13#include "common/logging/backend.h"
14#include "common/logging/filter.h"
14#include "common/logging/log.h" 15#include "common/logging/log.h"
15#include "common/logging/text_formatter.h" 16#include "common/logging/text_formatter.h"
16 17
@@ -105,7 +106,7 @@ void PrintMessage(const Entry& entry) {
105 fputc('\n', stderr); 106 fputc('\n', stderr);
106} 107}
107 108
108void TextLoggingLoop(std::shared_ptr<Logger> logger) { 109void TextLoggingLoop(std::shared_ptr<Logger> logger, const Filter* filter) {
109 std::array<Entry, 256> entry_buffer; 110 std::array<Entry, 256> entry_buffer;
110 111
111 while (true) { 112 while (true) {
@@ -114,7 +115,10 @@ void TextLoggingLoop(std::shared_ptr<Logger> logger) {
114 break; 115 break;
115 } 116 }
116 for (size_t i = 0; i < num_entries; ++i) { 117 for (size_t i = 0; i < num_entries; ++i) {
117 PrintMessage(entry_buffer[i]); 118 const Entry& entry = entry_buffer[i];
119 if (filter->CheckMessage(entry.log_class, entry.log_level)) {
120 PrintMessage(entry);
121 }
118 } 122 }
119 } 123 }
120} 124}