refactor: Logging (chat logger) (#5058)

It's no longer a singleton

It's now a unique_ptr that dies together with the Application

* Add getChatLogger to EmptyApplication

* unrelated change: Access Application::instance statically

* fix logging init order

* Add changelog entry
This commit is contained in:
pajlada
2023-12-31 13:51:40 +01:00
committed by GitHub
parent 036a5f3f21
commit 65b1ed312c
7 changed files with 31 additions and 14 deletions
+9 -2
View File
@@ -128,12 +128,12 @@ Application::Application(Settings &_settings, Paths &_paths, const Args &_args)
, userData(&this->emplace<UserDataController>())
, sound(&this->emplace<ISoundController>(makeSoundController(_settings)))
, twitchLiveController(&this->emplace<TwitchLiveController>())
, logging(new Logging(_settings))
#ifdef CHATTERINO_HAVE_PLUGINS
, plugins(&this->emplace<PluginController>())
#endif
, logging(&this->emplace<Logging>())
{
this->instance = this;
Application::instance = this;
// We can safely ignore this signal's connection since the Application will always
// be destroyed after fonts
@@ -142,6 +142,8 @@ Application::Application(Settings &_settings, Paths &_paths, const Args &_args)
});
}
Application::~Application() = default;
void Application::initialize(Settings &settings, Paths &paths)
{
assert(isAppInitialized == false);
@@ -312,6 +314,11 @@ ITwitchIrcServer *Application::getTwitch()
return this->twitch;
}
Logging *Application::getChatLogger()
{
return this->logging.get();
}
void Application::save()
{
for (auto &singleton : this->singletons_)