summaryrefslogtreecommitdiffstats
path: root/src/common/logging/backend.cpp
diff options
context:
space:
mode:
authorM&M <goldtextwitch@outlook.com>2020-07-29 19:25:37 +0200
committerM&M <goldtextwitch@outlook.com>2020-08-25 06:39:56 +0200
commit43ce33b6cced1d049f1cef3a9b1fddcfad8aef7c (patch)
tree3eb2d533a8edd88b54934aa35371fa7fb9d7bc30 /src/common/logging/backend.cpp
parentMerge pull request #4542 from ReinUsesLisp/gpu-init-base (diff)
downloadyuzu-43ce33b6cced1d049f1cef3a9b1fddcfad8aef7c.tar
yuzu-43ce33b6cced1d049f1cef3a9b1fddcfad8aef7c.tar.gz
yuzu-43ce33b6cced1d049f1cef3a9b1fddcfad8aef7c.tar.bz2
yuzu-43ce33b6cced1d049f1cef3a9b1fddcfad8aef7c.tar.lz
yuzu-43ce33b6cced1d049f1cef3a9b1fddcfad8aef7c.tar.xz
yuzu-43ce33b6cced1d049f1cef3a9b1fddcfad8aef7c.tar.zst
yuzu-43ce33b6cced1d049f1cef3a9b1fddcfad8aef7c.zip
Diffstat (limited to '')
-rw-r--r--src/common/logging/backend.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp
index 62cfde397..fdb2e52fa 100644
--- a/src/common/logging/backend.cpp
+++ b/src/common/logging/backend.cpp
@@ -23,6 +23,7 @@
#include "common/logging/text_formatter.h"
#include "common/string_util.h"
#include "common/threadsafe_queue.h"
+#include "core/settings.h"
namespace Log {
@@ -152,10 +153,19 @@ FileBackend::FileBackend(const std::string& filename)
void FileBackend::Write(const Entry& entry) {
// prevent logs from going over the maximum size (in case its spamming and the user doesn't
// know)
- constexpr std::size_t MAX_BYTES_WRITTEN = 50 * 1024L * 1024L;
- if (!file.IsOpen() || bytes_written > MAX_BYTES_WRITTEN) {
+ constexpr std::size_t MAX_BYTES_WRITTEN = 100 * 1024 * 1024;
+ constexpr std::size_t MAX_BYTES_WRITTEN_EXTENDED = 1024 * 1024 * 1024;
+
+ if (!file.IsOpen()) {
+ return;
+ }
+
+ if (Settings::values.extended_logging && bytes_written > MAX_BYTES_WRITTEN_EXTENDED) {
+ return;
+ } else if (!Settings::values.extended_logging && bytes_written > MAX_BYTES_WRITTEN) {
return;
}
+
bytes_written += file.WriteString(FormatLogMessage(entry).append(1, '\n'));
if (entry.log_level >= Level::Error) {
file.Flush();