mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
feat: write Dalamud.Boot logs to dalamud.boot.log
This commit is contained in:
parent
ad4f2db203
commit
a7540d0fef
5 changed files with 39 additions and 14 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue