diff options
| author | 2021-06-24 19:09:12 -0700 | |
|---|---|---|
| committer | 2021-06-24 19:09:12 -0700 | |
| commit | b9c2732121e2594a64d1141807c7d5bd0f317d0f (patch) | |
| tree | 700ab748e15d1e7d5cf7f58f2cbac133b7a84915 /src/common/logging | |
| parent | Merge pull request #6522 from Morph1984/pragma (diff) | |
| parent | common: Replace common_sizes into user-literals (diff) | |
| download | yuzu-b9c2732121e2594a64d1141807c7d5bd0f317d0f.tar.gz yuzu-b9c2732121e2594a64d1141807c7d5bd0f317d0f.tar.xz yuzu-b9c2732121e2594a64d1141807c7d5bd0f317d0f.zip | |
Merge pull request #6519 from Wunkolo/mem-size-literal
common: Replace common_sizes into user-literals
Diffstat (limited to 'src/common/logging')
| -rw-r--r-- | src/common/logging/backend.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index 47ce06478..b6fa4affb 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp | |||
| @@ -19,6 +19,8 @@ | |||
| 19 | #include "common/assert.h" | 19 | #include "common/assert.h" |
| 20 | #include "common/fs/file.h" | 20 | #include "common/fs/file.h" |
| 21 | #include "common/fs/fs.h" | 21 | #include "common/fs/fs.h" |
| 22 | #include "common/literals.h" | ||
| 23 | |||
| 22 | #include "common/logging/backend.h" | 24 | #include "common/logging/backend.h" |
| 23 | #include "common/logging/log.h" | 25 | #include "common/logging/log.h" |
| 24 | #include "common/logging/text_formatter.h" | 26 | #include "common/logging/text_formatter.h" |
| @@ -98,8 +100,8 @@ private: | |||
| 98 | write_logs(entry); | 100 | write_logs(entry); |
| 99 | } | 101 | } |
| 100 | 102 | ||
| 101 | // Drain the logging queue. Only writes out up to MAX_LOGS_TO_WRITE to prevent a case | 103 | // Drain the logging queue. Only writes out up to MAX_LOGS_TO_WRITE to prevent a |
| 102 | // where a system is repeatedly spamming logs even on close. | 104 | // case where a system is repeatedly spamming logs even on close. |
| 103 | const int MAX_LOGS_TO_WRITE = filter.IsDebug() ? INT_MAX : 100; | 105 | const int MAX_LOGS_TO_WRITE = filter.IsDebug() ? INT_MAX : 100; |
| 104 | int logs_written = 0; | 106 | int logs_written = 0; |
| 105 | while (logs_written++ < MAX_LOGS_TO_WRITE && message_queue.Pop(entry)) { | 107 | while (logs_written++ < MAX_LOGS_TO_WRITE && message_queue.Pop(entry)) { |
| @@ -169,10 +171,11 @@ FileBackend::FileBackend(const std::filesystem::path& filename) { | |||
| 169 | FileBackend::~FileBackend() = default; | 171 | FileBackend::~FileBackend() = default; |
| 170 | 172 | ||
| 171 | void FileBackend::Write(const Entry& entry) { | 173 | void FileBackend::Write(const Entry& entry) { |
| 174 | using namespace Common::Literals; | ||
| 172 | // prevent logs from going over the maximum size (in case its spamming and the user doesn't | 175 | // prevent logs from going over the maximum size (in case its spamming and the user doesn't |
| 173 | // know) | 176 | // know) |
| 174 | constexpr std::size_t MAX_BYTES_WRITTEN = 100 * 1024 * 1024; | 177 | constexpr std::size_t MAX_BYTES_WRITTEN = 100_MiB; |
| 175 | constexpr std::size_t MAX_BYTES_WRITTEN_EXTENDED = 1024 * 1024 * 1024; | 178 | constexpr std::size_t MAX_BYTES_WRITTEN_EXTENDED = 1_GiB; |
| 176 | 179 | ||
| 177 | if (!file->IsOpen()) { | 180 | if (!file->IsOpen()) { |
| 178 | return; | 181 | return; |