Merge pull request #6493 from peppy/logging-init-method

Add entry point to `Game` for logging setup purposes
This commit is contained in:
Dean Herbert
2025-01-15 20:03:30 +09:00
committed by GitHub
2 changed files with 15 additions and 0 deletions

View File

@@ -128,6 +128,20 @@ namespace osu.Framework
protected sealed override void AddInternal(Drawable drawable) => throw new InvalidOperationException($"Use {nameof(Add)} or {nameof(Content)} instead.");
/// <summary>
/// The earliest point of entry during <see cref="GameHost.Run"/> starting execution of a game.
/// This should be used to set up any low level tasks such as exception handling.
/// </summary>
/// <remarks>
/// At this point in execution, only <see cref="GameHost.Storage"/> and <see cref="GameHost.CacheStorage"/> are guaranteed to be valid for use.
/// They are provided as <paramref name="gameStorage"/> and <paramref name="cacheStorage"/> respectively for convenience.
/// </remarks>
/// <param name="gameStorage">The default game storage.</param>
/// <param name="cacheStorage">The default cache storage.</param>
public virtual void SetupLogging(Storage gameStorage, Storage cacheStorage)
{
}
/// <summary>
/// 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.
/// </summary>

View File

@@ -741,6 +741,7 @@ namespace osu.Framework.Platform
CacheStorage = GetDefaultGameStorage().GetStorageForDirectory("cache");
SetupForRun();
game.SetupLogging(Storage, CacheStorage);
populateInputHandlers();