mirror of
https://github.com/raphaeIl/Novaria.git
synced 2025-12-13 23:14:53 +01:00
Init commit
This commit is contained in:
55
NTR/Program.cs
Normal file
55
NTR/Program.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user