summaryrefslogtreecommitdiffstats
path: root/src/common/logging
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-11-23 22:34:15 +0100
committerGitHub <noreply@github.com>2020-11-23 22:34:15 +0100
commit5d1447897aebc371439507f42507bd98f1cfc223 (patch)
tree39bb9035ae1eeeb9988e69780f55e5bd5a5ef2c2 /src/common/logging
parentMerge pull request #4969 from liushuyu/master (diff)
parentlogging/settings: Increase maximum log size to 100 MB and add extended logging option (diff)
downloadyuzu-5d1447897aebc371439507f42507bd98f1cfc223.tar
yuzu-5d1447897aebc371439507f42507bd98f1cfc223.tar.gz
yuzu-5d1447897aebc371439507f42507bd98f1cfc223.tar.bz2
yuzu-5d1447897aebc371439507f42507bd98f1cfc223.tar.lz
yuzu-5d1447897aebc371439507f42507bd98f1cfc223.tar.xz
yuzu-5d1447897aebc371439507f42507bd98f1cfc223.tar.zst
yuzu-5d1447897aebc371439507f42507bd98f1cfc223.zip
Diffstat (limited to 'src/common/logging')
-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 7859344b9..631f64d05 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();