summaryrefslogtreecommitdiffstats
path: root/src/common/logging
diff options
context:
space:
mode:
authorFearlessTobi <thm.frey@gmail.com>2023-12-25 13:50:22 +0100
committerFearlessTobi <thm.frey@gmail.com>2023-12-26 10:35:14 +0100
commit4f569fd568590b43cd8d924a6abf3c13632a098a (patch)
tree8351b6afbd99abb2538286e5bd110317c5d5422e /src/common/logging
parentMerge pull request #12394 from liamwhite/per-process-memory (diff)
downloadyuzu-4f569fd568590b43cd8d924a6abf3c13632a098a.tar
yuzu-4f569fd568590b43cd8d924a6abf3c13632a098a.tar.gz
yuzu-4f569fd568590b43cd8d924a6abf3c13632a098a.tar.bz2
yuzu-4f569fd568590b43cd8d924a6abf3c13632a098a.tar.lz
yuzu-4f569fd568590b43cd8d924a6abf3c13632a098a.tar.xz
yuzu-4f569fd568590b43cd8d924a6abf3c13632a098a.tar.zst
yuzu-4f569fd568590b43cd8d924a6abf3c13632a098a.zip
Diffstat (limited to 'src/common/logging')
-rw-r--r--src/common/logging/backend.cpp17
-rw-r--r--src/common/logging/backend.h3
2 files changed, 20 insertions, 0 deletions
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp
index d4f27197c..7a267f8c0 100644
--- a/src/common/logging/backend.cpp
+++ b/src/common/logging/backend.cpp
@@ -208,6 +208,10 @@ public:
instance->StartBackendThread();
}
+ static void Stop() {
+ instance->StopBackendThread();
+ }
+
Impl(const Impl&) = delete;
Impl& operator=(const Impl&) = delete;
@@ -259,6 +263,15 @@ private:
});
}
+ void StopBackendThread() {
+ backend_thread.request_stop();
+ if (backend_thread.joinable()) {
+ backend_thread.join();
+ }
+
+ ForEachBackend([](Backend& backend) { backend.Flush(); });
+ }
+
Entry CreateEntry(Class log_class, Level log_level, const char* filename, unsigned int line_nr,
const char* function, std::string&& message) const {
using std::chrono::duration_cast;
@@ -313,6 +326,10 @@ void Start() {
Impl::Start();
}
+void Stop() {
+ Impl::Stop();
+}
+
void DisableLoggingInTests() {
initialization_in_progress_suppress_logging = true;
}
diff --git a/src/common/logging/backend.h b/src/common/logging/backend.h
index 12e5e2498..2a9926e9e 100644
--- a/src/common/logging/backend.h
+++ b/src/common/logging/backend.h
@@ -14,6 +14,9 @@ void Initialize();
void Start();
+/// Explicitly stops the logger thread and flushes the buffers
+void Stop();
+
void DisableLoggingInTests();
/**