Useful Extensions - Jandini/JandaBox GitHub Wiki
A few useful extensions that not necessarily have to belong to the template.
Add file logger
This extension creates an extra log file in given location. You might need to log all the actions related to processing data in selected folder.
internal static void AddFileLogger(this ILoggerFactory factory, FileInfo logFile)
{
factory
.AddSerilog(new LoggerConfiguration()
.Enrich.WithMachineName()
.WriteTo.File(
logFile.FullName,
outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u4}] [{MachineName}] [{SourceContext}] {Message}{NewLine}{Exception}")
.CreateLogger(), dispose: true);
}