Skip to content

Commit cd1e303

Browse files
authored
Merge pull request #6493 from peppy/logging-init-method
Add entry point to `Game` for logging setup purposes
2 parents 1696bad + 2c02900 commit cd1e303

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

osu.Framework/Game.cs

+14
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,20 @@ protected Game()
128128

129129
protected sealed override void AddInternal(Drawable drawable) => throw new InvalidOperationException($"Use {nameof(Add)} or {nameof(Content)} instead.");
130130

131+
/// <summary>
132+
/// The earliest point of entry during <see cref="GameHost.Run"/> starting execution of a game.
133+
/// This should be used to set up any low level tasks such as exception handling.
134+
/// </summary>
135+
/// <remarks>
136+
/// At this point in execution, only <see cref="GameHost.Storage"/> and <see cref="GameHost.CacheStorage"/> are guaranteed to be valid for use.
137+
/// They are provided as <paramref name="gameStorage"/> and <paramref name="cacheStorage"/> respectively for convenience.
138+
/// </remarks>
139+
/// <param name="gameStorage">The default game storage.</param>
140+
/// <param name="cacheStorage">The default cache storage.</param>
141+
public virtual void SetupLogging(Storage gameStorage, Storage cacheStorage)
142+
{
143+
}
144+
131145
/// <summary>
132146
/// 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.
133147
/// </summary>

osu.Framework/Platform/GameHost.cs

+1
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,7 @@ public void Run(Game game)
741741
CacheStorage = GetDefaultGameStorage().GetStorageForDirectory("cache");
742742

743743
SetupForRun();
744+
game.SetupLogging(Storage, CacheStorage);
744745

745746
populateInputHandlers();
746747

0 commit comments

Comments
 (0)