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.
This commit is contained in:
parent
a8340395a3
commit
98e9f4c32e
4 changed files with 16 additions and 11 deletions
|
@ -2,6 +2,7 @@
|
|||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <exception>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <utility>
|
||||
|
@ -68,9 +69,16 @@ Core::Timing& Global() {
|
|||
|
||||
System::~System() = default;
|
||||
|
||||
System& System::GetInstance() {
|
||||
if (!s_instance) {
|
||||
throw std::runtime_error("Using System instance before its initialization");
|
||||
}
|
||||
return *s_instance;
|
||||
}
|
||||
|
||||
void System::InitializeGlobalInstance() {
|
||||
if (s_instance) {
|
||||
std::abort();
|
||||
throw std::runtime_error("Reinitializing Global System instance.");
|
||||
}
|
||||
s_instance = std::unique_ptr<System>(new System);
|
||||
}
|
||||
|
|
|
@ -73,12 +73,7 @@ public:
|
|||
* Gets the instance of the System singleton class.
|
||||
* @returns Reference to the instance of the System singleton class.
|
||||
*/
|
||||
[[nodiscard]] static System& GetInstance() {
|
||||
if (!s_instance) {
|
||||
std::abort();
|
||||
}
|
||||
return *s_instance;
|
||||
}
|
||||
[[nodiscard]] static System& GetInstance();
|
||||
|
||||
static void InitializeGlobalInstance();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue