Currently, my Serilog implementation logs files in descending order - displays the oldest message at the top and the newest message at the bottom. I would like my implementation to log in ascending order - newest at the top and oldest at the bottom.
This is what I currently have in Program.cs
:
public static void Main(string[] args)
{
string timestamp = DateTime.Now.ToString("[yyyy-MM-dd][HH.mm.ss tt]", CultureInfo.InvariantCulture);
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.Enrich.FromLogContext()
.WriteTo.File($"C:\\Logs\\{timestamp}-log.txt",
outputTemplate: "Time:{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] {Message:lj}{NewLine}{Exception}",
rollingInterval: RollingInterval.Day,
restrictedToMinimumLevel: LogEventLevel.Information
)
.CreateLogger();
CreateHostBuilder(args).Build().Run();
}
How can I achieve this?