mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-31 21:03:43 +01:00
feat: allow specifying logging path via --logpath, make sure serilog can always write to injector log
This commit is contained in:
parent
b901ad5aff
commit
2e380b10d5
4 changed files with 40 additions and 17 deletions
|
|
@ -88,13 +88,9 @@ public sealed class EntryPoint
|
|||
{
|
||||
var logFileName = logName.IsNullOrEmpty() ? "dalamud" : $"dalamud-{logName}";
|
||||
|
||||
#if DEBUG
|
||||
var logPath = new FileInfo(Path.Combine(baseDirectory, $"{logFileName}.log"));
|
||||
var oldPath = new FileInfo(Path.Combine(baseDirectory, $"{logFileName}.old.log"));
|
||||
#else
|
||||
var logPath = Path.Combine(baseDirectory, "..", "..", "..", $"{logFileName}.log");
|
||||
var oldPath = Path.Combine(baseDirectory, "..", "..", "..", $"{logFileName}.old.log");
|
||||
#endif
|
||||
|
||||
Log.CloseAndFlush();
|
||||
|
||||
RetentionBehaviour behaviour;
|
||||
|
|
@ -137,7 +133,7 @@ public sealed class EntryPoint
|
|||
private static void RunThread(DalamudStartInfo info, IntPtr mainThreadContinueEvent)
|
||||
{
|
||||
// Setup logger
|
||||
InitLogging(info.WorkingDirectory!, info.BootShowConsole, true, info.LogName);
|
||||
InitLogging(info.LogPath!, info.BootShowConsole, true, info.LogName);
|
||||
SerilogEventSink.Instance.LogLine += SerilogOnLogLine;
|
||||
|
||||
// Load configuration first to get some early persistent state, like log level
|
||||
|
|
@ -145,7 +141,7 @@ public sealed class EntryPoint
|
|||
|
||||
// Set the appropriate logging level from the configuration
|
||||
if (!configuration.LogSynchronously)
|
||||
InitLogging(info.WorkingDirectory!, info.BootShowConsole, configuration.LogSynchronously, info.LogName);
|
||||
InitLogging(info.LogPath!, info.BootShowConsole, configuration.LogSynchronously, info.LogName);
|
||||
LogLevelSwitch.MinimumLevel = configuration.LogLevel;
|
||||
|
||||
// Log any unhandled exception.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue