diff --git a/Wabbajack.Common/StoreHandlers/StoreHandler.cs b/Wabbajack.Common/StoreHandlers/StoreHandler.cs index e88da2fb..01c2b748 100644 --- a/Wabbajack.Common/StoreHandlers/StoreHandler.cs +++ b/Wabbajack.Common/StoreHandlers/StoreHandler.cs @@ -14,16 +14,15 @@ namespace Wabbajack.Common.StoreHandlers { public class StoreHandler { - private static readonly StoreHandlerLogger Logger = new(); - + private static readonly Lazy _instance = new(() => new StoreHandler(), isThreadSafe: true); public static StoreHandler Instance => _instance.Value; - private static readonly Lazy SteamHandler = new(() => new SteamHandler(Logger)); - private static readonly Lazy GogHandler = new(() => new GOGHandler(Logger)); - private static readonly Lazy BethNetHandler = new(() => new BethNetHandler(Logger)); - private static readonly Lazy EpicGameStoreHandler = new(() => new EGSHandler(Logger)); - private static readonly Lazy OriginHandler = new(() => new OriginHandler(true, true, Logger)); + private static readonly Lazy SteamHandler = new(() => new SteamHandler(new StoreHandlerLogger("Steam"))); + private static readonly Lazy GogHandler = new(() => new GOGHandler(new StoreHandlerLogger("GOG"))); + private static readonly Lazy BethNetHandler = new(() => new BethNetHandler(new StoreHandlerLogger("BethNet"))); + private static readonly Lazy EpicGameStoreHandler = new(() => new EGSHandler(new StoreHandlerLogger("EGS"))); + private static readonly Lazy OriginHandler = new(() => new OriginHandler(true, true, new StoreHandlerLogger("Origin"))); private readonly List _storeGames; public Dictionary Games = new(); @@ -100,9 +99,16 @@ namespace Wabbajack.Common.StoreHandlers internal class StoreHandlerLogger : ILogger { + private readonly string _name; + + public StoreHandlerLogger(string name) + { + _name = name; + } + public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) { - Utils.Log(formatter(state, exception)); + Utils.Log($"{_name}: {formatter(state, exception)}"); } public bool IsEnabled(LogLevel logLevel) => true;