From df39ca7a1c9a424006e4c3badb2b8ae3885e3e1f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jan 2025 18:46:41 +0900 Subject: [PATCH 1/4] Add entry point to `Game` for logging setup purposes --- osu.Framework/Game.cs | 13 +++++++++++++ osu.Framework/Platform/GameHost.cs | 1 + 2 files changed, 14 insertions(+) diff --git a/osu.Framework/Game.cs b/osu.Framework/Game.cs index 1f7a8e827..21cb627aa 100644 --- a/osu.Framework/Game.cs +++ b/osu.Framework/Game.cs @@ -128,6 +128,19 @@ namespace osu.Framework protected sealed override void AddInternal(Drawable drawable) => throw new InvalidOperationException($"Use {nameof(Add)} or {nameof(Content)} instead."); + /// + /// The earliest point of entry during starting execution of a game. + /// This should be used to set up any low level tasks such as exception handling. + /// + /// + /// At this point in execution, only + /// + /// The default game storage. + /// The default cache storage. + public virtual void SetupLogging(Storage gameStorage, Storage cacheStorage) + { + } + /// /// As Load is run post host creation, you can override this method to alter properties of the host before it makes itself visible to the user. /// diff --git a/osu.Framework/Platform/GameHost.cs b/osu.Framework/Platform/GameHost.cs index 85b83b988..3d159dc63 100644 --- a/osu.Framework/Platform/GameHost.cs +++ b/osu.Framework/Platform/GameHost.cs @@ -741,6 +741,7 @@ namespace osu.Framework.Platform CacheStorage = GetDefaultGameStorage().GetStorageForDirectory("cache"); SetupForRun(); + game.SetupLogging(Storage, CacheStorage); populateInputHandlers(); From 47442decb7b862be046b1918a1ce0d247c71f48f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 15 Jan 2025 19:10:11 +0900 Subject: [PATCH 2/4] Fix half-written comment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bartłomiej Dach --- osu.Framework/Game.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Framework/Game.cs b/osu.Framework/Game.cs index 21cb627aa..bb1446ab5 100644 --- a/osu.Framework/Game.cs +++ b/osu.Framework/Game.cs @@ -133,7 +133,7 @@ namespace osu.Framework /// This should be used to set up any low level tasks such as exception handling. /// /// - /// At this point in execution, only + /// At this point in execution, only and are guaranteed to be valid for use. /// /// The default game storage. /// The default cache storage. From 35e0c31fb60df1c807861bafcecdc4cad8d0c5cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 15 Jan 2025 11:39:47 +0100 Subject: [PATCH 3/4] Fix references --- osu.Framework/Game.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Framework/Game.cs b/osu.Framework/Game.cs index bb1446ab5..a362d40be 100644 --- a/osu.Framework/Game.cs +++ b/osu.Framework/Game.cs @@ -133,7 +133,7 @@ namespace osu.Framework /// This should be used to set up any low level tasks such as exception handling. /// /// - /// At this point in execution, only and are guaranteed to be valid for use. + /// At this point in execution, only and are guaranteed to be valid for use. /// /// The default game storage. /// The default cache storage. From 2c0290040193be46868ef5fcfb3062039759376c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 15 Jan 2025 11:40:25 +0100 Subject: [PATCH 4/4] Expand comment a bit more also --- osu.Framework/Game.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Framework/Game.cs b/osu.Framework/Game.cs index a362d40be..30d048699 100644 --- a/osu.Framework/Game.cs +++ b/osu.Framework/Game.cs @@ -134,6 +134,7 @@ namespace osu.Framework /// /// /// At this point in execution, only and are guaranteed to be valid for use. + /// They are provided as and respectively for convenience. /// /// The default game storage. /// The default cache storage.