Skip to content

Commit

Permalink
Fix compiler logfile naming issue
Browse files Browse the repository at this point in the history
  • Loading branch information
austinv900 committed Nov 19, 2023
1 parent 176a030 commit f33d714
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,24 @@ internal class Program
.WithLogging((logging, cfg) =>
{
IConfigurationSection logSettings = cfg.GetSection("Logging");
string filePath = logSettings.GetValue("FileName", "oxide.compiler.log");
if (string.IsNullOrWhiteSpace(filePath))
{
filePath = "oxide.compiler.log";
}
if (filePath.Equals("oxide.compiler.log"))
{
IConfigurationSection pathSettings = cfg.GetSection("Path");
string startDirectory = pathSettings.GetValue("Logging", Environment.CurrentDirectory);
filePath = Path.Combine(startDirectory, filePath);
}
Log.Logger = new LoggerConfiguration()
.MinimumLevel.ControlledBy(ApplicationLogLevel)
.Enrich.FromLogContext()
.WriteTo.File(logSettings.GetValue<string>("FileName", "compiler.log"),
.WriteTo.File(filePath,
rollOnFileSizeLimit: true,
fileSizeLimitBytes: (long)5e+6,
retainedFileCountLimit: 5,
Expand Down

0 comments on commit f33d714

Please sign in to comment.