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:
+9
-2
@@ -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_)
|
||||
|
||||
Reference in New Issue
Block a user