feat: write Dalamud.Boot logs to dalamud.boot.log

This commit is contained in:
goaaats 2022-05-29 17:25:29 +02:00
parent ad4f2db203
commit a7540d0fef
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B
5 changed files with 39 additions and 14 deletions

View file

@ -101,6 +101,19 @@ namespace Dalamud.Injector
}
}
private static string GetLogPath(string filename)
{
var baseDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
#if DEBUG
var logPath = Path.Combine(baseDirectory, $"{filename}.log");
#else
var logPath = Path.Combine(baseDirectory, "..", "..", "..", "dalamud.injector.log");
#endif
return logPath;
}
private static void Init(List<string> args)
{
InitUnhandledException(args);
@ -161,14 +174,6 @@ namespace Dalamud.Injector
private static void InitLogging()
{
var baseDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
#if DEBUG
var logPath = Path.Combine(baseDirectory, "dalamud.injector.log");
#else
var logPath = Path.Combine(baseDirectory, "..", "..", "..", "dalamud.injector.log");
#endif
var levelSwitch = new LoggingLevelSwitch();
#if DEBUG
@ -177,6 +182,10 @@ namespace Dalamud.Injector
levelSwitch.MinimumLevel = LogEventLevel.Information;
#endif
var logPath = GetLogPath("dalamud.injector");
Environment.SetEnvironmentVariable("DALAMUD_BOOT_LOGFILE", GetLogPath("dalamud.boot"));
CullLogFile(logPath, 1 * 1024 * 1024);
Log.Logger = new LoggerConfiguration()