public static LoggerConfiguration CreateDefaultConfiguration(SerilogRollingFileConfiguration fileConfiguration) { return new LoggerConfiguration() .Enrich.WithThreadId() .MinimumLevel.ControlledBy(fileConfiguration.GetLoggingLevelSwitch()) .WriteTo.ColoredConsole( outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} - {ThreadId} - [{Level}] {Message}{NewLine}{Exception}") .WriteTo.RollingFile( fileConfiguration.FilePath, fileSizeLimitBytes: fileConfiguration.FileSize, retainedFileCountLimit: fileConfiguration.NumberOfFilesToKeep); }
public SerilogLogger(SerilogRollingFileConfiguration fileConfiguration) { _logger = CreateDefaultConfiguration(fileConfiguration) .CreateLogger(); }