Files
VoxelEngine/Program.cs
MDietermann 9193df2710 style: drop redundant type qualifiers, use explicit types (IDE cleanup)
Pure formatting from the IDE's code cleanup: remove redundant ClassName./namespace qualifiers and replace var with explicit types. No behavior change.
2026-06-03 16:26:32 +02:00

46 lines
1.2 KiB
C#

using OpenTK.Mathematics;
using OpenTK.Windowing.Common;
using OpenTK.Windowing.Desktop;
using Serilog;
using Serilog.Events;
using VoxelEngine.Core;
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.Enrich.FromLogContext()
.WriteTo.Console(
restrictedToMinimumLevel: LogEventLevel.Information,
outputTemplate: "[{Timestamp:HH:mm:ss.fff} {Level:u3}] [{SourceContext}] {Message:lj}{NewLine}{Exception}")
.WriteTo.File(
path: "logs/voxelengine-.log",
rollingInterval: RollingInterval.Day,
retainedFileCountLimit: 14,
outputTemplate: "[{Timestamp:HH:mm:ss.fff} {Level:u3}] [{SourceContext}] {Message:lj}{NewLine}{Exception}")
.CreateLogger();
try
{
Configuration cfg = new();
NativeWindowSettings nativeSettings = new()
{
ClientSize = new Vector2i(cfg.WindowWidth, cfg.WindowHeight),
Title = "VoxelEngine",
APIVersion = new Version(3, 3),
Profile = ContextProfile.Core,
Flags = ContextFlags.ForwardCompatible
};
using Game game = new(cfg, GameWindowSettings.Default, nativeSettings);
game.Run();
}
catch (Exception ex)
{
Log.Fatal(ex, "Unhandled exception at top level");
throw;
}
finally
{
Log.CloseAndFlush();
}