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
@@ -68,6 +68,7 @@ public:
virtual HighlightController *getHighlights() = 0;
virtual NotificationController *getNotifications() = 0;
virtual ITwitchIrcServer *getTwitch() = 0;
virtual Logging *getChatLogger() = 0;
virtual ChatterinoBadges *getChatterinoBadges() = 0;
virtual FfzBadges *getFfzBadges() = 0;
virtual SeventvBadges *getSeventvBadges() = 0;
@@ -89,6 +90,12 @@ public:
static Application *instance;
Application(Settings &_settings, Paths &_paths, const Args &_args);
~Application() override;
Application(const Application &) = delete;
Application(Application &&) = delete;
Application &operator=(const Application &) = delete;
Application &operator=(Application &&) = delete;
void initialize(Settings &settings, Paths &paths);
void load();
@@ -121,14 +128,13 @@ public:
private:
TwitchLiveController *const twitchLiveController{};
const std::unique_ptr<Logging> logging;
public:
#ifdef CHATTERINO_HAVE_PLUGINS
PluginController *const plugins{};
#endif
/*[[deprecated]]*/ Logging *const logging{};
const Args &getArgs() override
{
return this->args_;
@@ -175,6 +181,7 @@ public:
return this->highlights;
}
ITwitchIrcServer *getTwitch() override;
Logging *getChatLogger() override;
ChatterinoBadges *getChatterinoBadges() override
{
return this->chatterinoBadges;