mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-03 06:13:40 +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
|
|
@ -28,6 +28,7 @@ public record DalamudStartInfo : IServiceType
|
|||
{
|
||||
this.WorkingDirectory = other.WorkingDirectory;
|
||||
this.ConfigurationPath = other.ConfigurationPath;
|
||||
this.LogPath = other.LogPath;
|
||||
this.LogName = other.LogName;
|
||||
this.PluginDirectory = other.PluginDirectory;
|
||||
this.AssetDirectory = other.AssetDirectory;
|
||||
|
|
@ -61,6 +62,11 @@ public record DalamudStartInfo : IServiceType
|
|||
/// </summary>
|
||||
public string? ConfigurationPath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the path of the log files.
|
||||
/// </summary>
|
||||
public string? LogPath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the log file.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -642,7 +642,7 @@ internal class DalamudInterface : IDisposable, IServiceType
|
|||
configuration.QueueSave();
|
||||
|
||||
EntryPoint.InitLogging(
|
||||
startInfo.WorkingDirectory!,
|
||||
startInfo.LogPath!,
|
||||
startInfo.BootShowConsole,
|
||||
configuration.LogSynchronously,
|
||||
startInfo.LogName);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue