Skip to content

Commit

Permalink
bug fix for log
Browse files Browse the repository at this point in the history
  • Loading branch information
arm64v8a committed Dec 19, 2022
1 parent 788b92e commit 647f20c
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions ui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1271,15 +1271,24 @@ inline void FastAppendTextDocument(const QString &message, QTextDocument *doc) {
}

void MainWindow::show_log_impl(const QString &log) {
auto log2 = log.trimmed();
if (log2.isEmpty()) return;
auto lines = SplitLines(log.trimmed());
if (lines.isEmpty()) return;

QStringList newLines;
auto log_ignore = NekoRay::dataStore->log_ignore;
for (const auto &str: log_ignore) {
if (log2.contains(str)) return;
for (const auto &line: lines) {
bool showThisLine = true;
for (const auto &str: log_ignore) {
if (line.contains(str)) {
showThisLine = false;
break;
}
}
if (showThisLine) newLines << line;
}
if (newLines.isEmpty()) return;

FastAppendTextDocument(log2, qvLogDocument);
FastAppendTextDocument(newLines.join("\n"), qvLogDocument);
// qvLogDocument->setPlainText(qvLogDocument->toPlainText() + log);
// From https://gist.github.com/jemyzhang/7130092
auto maxLines = 200;
Expand Down

0 comments on commit 647f20c

Please sign in to comment.