summaryrefslogtreecommitdiff
path: root/src/common/logging/text_formatter.cpp
diff options
context:
space:
mode:
authorGravatar Emmanuel Gil Peyrot2015-03-06 19:15:02 +0100
committerGravatar Emmanuel Gil Peyrot2015-03-06 19:23:52 +0100
commit0aa44e238db7a72f4fb8b347168ec76c3ce48ad5 (patch)
treedba02c60d0a663708265089394c634a655417f9d /src/common/logging/text_formatter.cpp
parentMerge pull request #630 from archshift/swap (diff)
downloadyuzu-0aa44e238db7a72f4fb8b347168ec76c3ce48ad5.tar.gz
yuzu-0aa44e238db7a72f4fb8b347168ec76c3ce48ad5.tar.xz
yuzu-0aa44e238db7a72f4fb8b347168ec76c3ce48ad5.zip
Logging: check for filter before sending to the queue, to skip all heavy formatting on the other thread.
Diffstat (limited to 'src/common/logging/text_formatter.cpp')
-rw-r--r--src/common/logging/text_formatter.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/common/logging/text_formatter.cpp b/src/common/logging/text_formatter.cpp
index ef5739d84..36c91c4f6 100644
--- a/src/common/logging/text_formatter.cpp
+++ b/src/common/logging/text_formatter.cpp
@@ -11,7 +11,6 @@
11#endif 11#endif
12 12
13#include "common/logging/backend.h" 13#include "common/logging/backend.h"
14#include "common/logging/filter.h"
15#include "common/logging/log.h" 14#include "common/logging/log.h"
16#include "common/logging/text_formatter.h" 15#include "common/logging/text_formatter.h"
17 16
@@ -116,7 +115,7 @@ void PrintColoredMessage(const Entry& entry) {
116#endif 115#endif
117} 116}
118 117
119void TextLoggingLoop(std::shared_ptr<Logger> logger, const Filter* filter) { 118void TextLoggingLoop(std::shared_ptr<Logger> logger) {
120 std::array<Entry, 256> entry_buffer; 119 std::array<Entry, 256> entry_buffer;
121 120
122 while (true) { 121 while (true) {
@@ -126,9 +125,7 @@ void TextLoggingLoop(std::shared_ptr<Logger> logger, const Filter* filter) {
126 } 125 }
127 for (size_t i = 0; i < num_entries; ++i) { 126 for (size_t i = 0; i < num_entries; ++i) {
128 const Entry& entry = entry_buffer[i]; 127 const Entry& entry = entry_buffer[i];
129 if (filter->CheckMessage(entry.log_class, entry.log_level)) { 128 PrintColoredMessage(entry);
130 PrintColoredMessage(entry);
131 }
132 } 129 }
133 } 130 }
134} 131}