aboutsummaryrefslogtreecommitdiff
path: root/src/common/logging/backend.cpp
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2021-08-24 01:32:38 -0400
committerameerj <52414509+ameerj@users.noreply.github.com>2021-08-24 01:32:38 -0400
commit84b4ac572954c3fbf114a877f00a12020d3b31f8 (patch)
tree4b257caf10eb6e7dfd2113671a7ebdcd845dcf3b /src/common/logging/backend.cpp
parentbed0c3c92a6db45b29e787016fd21542606a031a (diff)
logging: Fix log filter during initialization
The log filter was being ignored on initialization due to the logging instance being initialized before the config instance, so the log filter was set to its default value. This fixes that oversight, along with using descriptive exceptions instead of abort() calls.
Diffstat (limited to 'src/common/logging/backend.cpp')
-rw-r--r--src/common/logging/backend.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp
index 13edda9c9f..949384fd3d 100644
--- a/src/common/logging/backend.cpp
+++ b/src/common/logging/backend.cpp
@@ -5,6 +5,7 @@
#include <atomic>
#include <chrono>
#include <climits>
+#include <exception>
#include <thread>
#include <vector>
@@ -152,7 +153,7 @@ public:
void EnableForStacktrace() override {}
};
-bool initialization_in_progress_suppress_logging = false;
+bool initialization_in_progress_suppress_logging = true;
/**
* Static state as a singleton.
@@ -161,17 +162,17 @@ class Impl {
public:
static Impl& Instance() {
if (!instance) {
- abort();
+ throw std::runtime_error("Using Logging instance before its initialization");
}
return *instance;
}
static void Initialize() {
if (instance) {
- abort();
+ LOG_WARNING(Log, "Reinitializing logging backend");
+ return;
}
using namespace Common::FS;
- initialization_in_progress_suppress_logging = true;
const auto& log_dir = GetYuzuPath(YuzuPath::LogDir);
void(CreateDir(log_dir));
Filter filter;