I am using Serilog for logging and cant\' figure out how to separate log events to different files. For example, I want to log errors to error_log-ddmmyyyy.txt and warnings
Usually for my use-cases I need multiple logs that will contain a minimum level for each. This way I can later investigate the logs more efficiently.
For more recent versions of Serilog I would suggest to use this:
Log.Logger = new LoggerConfiuration()
.MinimumLevel.Debug()
.WriteTo.File(path: "debug.log", rollingInterval: RollingInterval.Day)
.WriteTo.File(path: "info.log", restrictedToMinimumLevel: LogEventLevel.Information, rollingInterval: RollingInterval.Day)
.WriteTo.File(path: "error.log",restrictedToMinimumLevel: LogEventLevel.Error, rollingInterval: RollingInterval.Day)
.WriteTo.Console(restrictedToMinimumLevel: LogEventLevel.Warning)
.CreateLogger();