diff options
| author | 2021-01-10 22:09:56 -0700 | |
|---|---|---|
| committer | 2021-01-10 22:09:56 -0700 | |
| commit | 7a3c884e39fccfbb498b855080bffabc9ce2e7f1 (patch) | |
| tree | 5056f9406dec188439cb0deb87603498243a9412 /src/common/logging/backend.cpp | |
| parent | More forgetting... duh (diff) | |
| parent | Merge pull request #5229 from Morph1984/fullscreen-opt (diff) | |
| download | yuzu-7a3c884e39fccfbb498b855080bffabc9ce2e7f1.tar.gz yuzu-7a3c884e39fccfbb498b855080bffabc9ce2e7f1.tar.xz yuzu-7a3c884e39fccfbb498b855080bffabc9ce2e7f1.zip | |
Merge remote-tracking branch 'upstream/master' into int-flags
Diffstat (limited to 'src/common/logging/backend.cpp')
| -rw-r--r-- | src/common/logging/backend.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index 62cfde397..631f64d05 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include "common/logging/text_formatter.h" | 23 | #include "common/logging/text_formatter.h" |
| 24 | #include "common/string_util.h" | 24 | #include "common/string_util.h" |
| 25 | #include "common/threadsafe_queue.h" | 25 | #include "common/threadsafe_queue.h" |
| 26 | #include "core/settings.h" | ||
| 26 | 27 | ||
| 27 | namespace Log { | 28 | namespace Log { |
| 28 | 29 | ||
| @@ -152,10 +153,19 @@ FileBackend::FileBackend(const std::string& filename) | |||
| 152 | void FileBackend::Write(const Entry& entry) { | 153 | void FileBackend::Write(const Entry& entry) { |
| 153 | // prevent logs from going over the maximum size (in case its spamming and the user doesn't | 154 | // prevent logs from going over the maximum size (in case its spamming and the user doesn't |
| 154 | // know) | 155 | // know) |
| 155 | constexpr std::size_t MAX_BYTES_WRITTEN = 50 * 1024L * 1024L; | 156 | constexpr std::size_t MAX_BYTES_WRITTEN = 100 * 1024 * 1024; |
| 156 | if (!file.IsOpen() || bytes_written > MAX_BYTES_WRITTEN) { | 157 | constexpr std::size_t MAX_BYTES_WRITTEN_EXTENDED = 1024 * 1024 * 1024; |
| 158 | |||
| 159 | if (!file.IsOpen()) { | ||
| 160 | return; | ||
| 161 | } | ||
| 162 | |||
| 163 | if (Settings::values.extended_logging && bytes_written > MAX_BYTES_WRITTEN_EXTENDED) { | ||
| 164 | return; | ||
| 165 | } else if (!Settings::values.extended_logging && bytes_written > MAX_BYTES_WRITTEN) { | ||
| 157 | return; | 166 | return; |
| 158 | } | 167 | } |
| 168 | |||
| 159 | bytes_written += file.WriteString(FormatLogMessage(entry).append(1, '\n')); | 169 | bytes_written += file.WriteString(FormatLogMessage(entry).append(1, '\n')); |
| 160 | if (entry.log_level >= Level::Error) { | 170 | if (entry.log_level >= Level::Error) { |
| 161 | file.Flush(); | 171 | file.Flush(); |
| @@ -222,6 +232,7 @@ void DebuggerBackend::Write(const Entry& entry) { | |||
| 222 | SUB(Service, NPNS) \ | 232 | SUB(Service, NPNS) \ |
| 223 | SUB(Service, NS) \ | 233 | SUB(Service, NS) \ |
| 224 | SUB(Service, NVDRV) \ | 234 | SUB(Service, NVDRV) \ |
| 235 | SUB(Service, OLSC) \ | ||
| 225 | SUB(Service, PCIE) \ | 236 | SUB(Service, PCIE) \ |
| 226 | SUB(Service, PCTL) \ | 237 | SUB(Service, PCTL) \ |
| 227 | SUB(Service, PCV) \ | 238 | SUB(Service, PCV) \ |
| @@ -274,7 +285,6 @@ const char* GetLogClassName(Class log_class) { | |||
| 274 | case Class::Count: | 285 | case Class::Count: |
| 275 | break; | 286 | break; |
| 276 | } | 287 | } |
| 277 | UNREACHABLE(); | ||
| 278 | return "Invalid"; | 288 | return "Invalid"; |
| 279 | } | 289 | } |
| 280 | 290 | ||
| @@ -293,7 +303,6 @@ const char* GetLevelName(Level log_level) { | |||
| 293 | break; | 303 | break; |
| 294 | } | 304 | } |
| 295 | #undef LVL | 305 | #undef LVL |
| 296 | UNREACHABLE(); | ||
| 297 | return "Invalid"; | 306 | return "Invalid"; |
| 298 | } | 307 | } |
| 299 | 308 | ||