mirror of
https://github.com/raphaeIl/Novaria.git
synced 2025-12-13 15:04:36 +01:00
55 lines
1.8 KiB
C#
55 lines
1.8 KiB
C#
using Microsoft.Extensions.Configuration;
|
|
using Serilog.Events;
|
|
using Serilog;
|
|
|
|
namespace NTR
|
|
{
|
|
internal class Program
|
|
{
|
|
public static void Main(string[] args)
|
|
{
|
|
var config = new ConfigurationBuilder()
|
|
.SetBasePath(Path.GetDirectoryName(AppContext.BaseDirectory)!)
|
|
.AddJsonFile("appsettings.json")
|
|
.AddJsonFile(
|
|
$"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Production"}.json",
|
|
true
|
|
)
|
|
.AddJsonFile("appsettings.Local.json", true)
|
|
.Build();
|
|
|
|
{
|
|
var logFilePath = Path.Combine(
|
|
Path.GetDirectoryName(AppContext.BaseDirectory)!,
|
|
"logs",
|
|
"log.txt"
|
|
);
|
|
|
|
if (File.Exists(logFilePath))
|
|
{
|
|
var prevLogFilePath = Path.Combine(
|
|
Path.GetDirectoryName(logFilePath)!,
|
|
"log-prev.txt"
|
|
);
|
|
if (File.Exists(prevLogFilePath))
|
|
File.Delete(prevLogFilePath);
|
|
|
|
File.Move(logFilePath, prevLogFilePath);
|
|
}
|
|
|
|
Log.Logger = new LoggerConfiguration()
|
|
.WriteTo.Console()
|
|
.WriteTo.File(
|
|
logFilePath,
|
|
restrictedToMinimumLevel: LogEventLevel.Verbose,
|
|
shared: true
|
|
)
|
|
.ReadFrom.Configuration(config)
|
|
.CreateBootstrapLogger();
|
|
}
|
|
|
|
Task.Run(GameServer.GameServer.Instance.Start);
|
|
SDKServer.SDKServer.Main(args);
|
|
}
|
|
}
|
|
} |