Hmm...
This commit is contained in:
@ -10,9 +10,11 @@ namespace RageCoop.Server
|
|||||||
class Program
|
class Program
|
||||||
{
|
{
|
||||||
private static bool Stopping = false;
|
private static bool Stopping = false;
|
||||||
|
static Logger mainLogger;
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
var mainLogger= new Logger()
|
AppDomain.CurrentDomain.UnhandledException+=UnhandledException;
|
||||||
|
mainLogger = new Logger()
|
||||||
{
|
{
|
||||||
LogPath="RageCoop.Server.log",
|
LogPath="RageCoop.Server.log",
|
||||||
UseConsole=true,
|
UseConsole=true,
|
||||||
@ -66,12 +68,23 @@ namespace RageCoop.Server
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
mainLogger.Error(e);
|
Fatal(e);
|
||||||
mainLogger.Error($"Fatal error occurred, server shutting down.");
|
|
||||||
mainLogger.Flush();
|
|
||||||
Thread.Sleep(5000);
|
|
||||||
Environment.Exit(1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||||
|
{
|
||||||
|
mainLogger.Error($"Unhandled exception thrown from user thread:",e.ExceptionObject as Exception);
|
||||||
|
mainLogger.Flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Fatal(Exception e)
|
||||||
|
{
|
||||||
|
mainLogger.Error(e);
|
||||||
|
mainLogger.Error($"Fatal error occurred, server shutting down.");
|
||||||
|
mainLogger.Flush();
|
||||||
|
Thread.Sleep(5000);
|
||||||
|
Environment.Exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user