mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-28 23:19:53 +08:00
fix Log Init
This commit is contained in:
@@ -11,7 +11,11 @@ namespace System;
|
||||
/// </summary>
|
||||
public static class Log
|
||||
{
|
||||
internal static ILoggerFactory Factory => DI.Get<ILoggerFactory>();
|
||||
public static Func<ILoggerFactory>? LoggerFactory { private get; set; }
|
||||
|
||||
static ILoggerFactory? factory;
|
||||
|
||||
public static ILoggerFactory Factory => factory ??= DI.Get_Nullable<ILoggerFactory>() ?? LoggerFactory?.Invoke() ?? throw new ArgumentNullException(nameof(LoggerFactory));
|
||||
|
||||
public static ILogger CreateLogger(string tag) => Factory.CreateLogger(tag);
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ namespace System.Application.UI
|
||||
// Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux)
|
||||
PlatformApp?.Dispose();
|
||||
DI.Dispose();
|
||||
LogManager.Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -248,6 +248,8 @@ namespace System.Application.UI
|
||||
}
|
||||
config.LoggingRules.Add(new LoggingRule("*", minLevel, target));
|
||||
}
|
||||
|
||||
Log.LoggerFactory = () => new LoggerFactory(new[] { new NLogLoggerProvider() });
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user