I am already logging into an API file and would like to log into a different file for just one class. Therefore I used Filter.ByIncludingOnly to accomplish this, and it is working as expected.
However, it does not take into account the 'fileSizeLimitBytes' property. Once it reaches a size of 98 KB, it creates another file. is there any other way to achieve it?
Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration(configuration)
.WriteTo.Logger(lc => lc
.Filter.ByIncludingOnly(evt => evt.Properties.ContainsKey("SourceContext")
&& evt.Properties["SourceContext"].ToString().Contains("Web.Core.Helpers.ExcelReader"))
.WriteTo.Map("Name", "import", (name, wt) => wt.File($"./Logs/log-{name}-.txt",
rollingInterval: RollingInterval.Day,
fileSizeLimitBytes: 200000, // File size limit for the 'import' key
rollOnFileSizeLimit: true,
retainedFileCountLimit: 60)))
.WriteTo.Logger(lc => lc
.WriteTo.Map("Name", "api", (name, wt) => wt.File($"./Logs/log-{name}-.txt",
rollingInterval: RollingInterval.Day,
fileSizeLimitBytes: 100000,
rollOnFileSizeLimit: true,
retainedFileCountLimit: 60)))
.CreateLogger();