Adds logging for shutdown errors (#45)

* Adds logging for startup and shutdown errors

* You aren't doing the thing I asked

* Remove this

* Just this
This commit is contained in:
Jordan Brown
2017-06-14 09:40:43 +02:00
committed by AnturK
parent 630df7215a
commit a8ac8d749e
+7 -4
View File
@@ -10,20 +10,20 @@ namespace TGServerService
{
public partial class TGServerService : ServiceBase
{
static TGServerService ActiveService; //So everyone else can write to our eventlog
static TGServerService ActiveService; //So everyone else can write to our eventlog
public static void WriteLog(string message, EventLogEntryType type = EventLogEntryType.Information)
{
ActiveService.EventLog.WriteEntry(message, type);
}
public static void LocalStop()
{
ThreadPool.QueueUserWorkItem(_ => { ActiveService.Stop(); });
}
ServiceHost host; //the WCF host
//you should seriously not add anything here
//Use OnStart instead
public TGServerService()
@@ -82,7 +82,10 @@ namespace TGServerService
host.Close(); //where TGStationServer.Dispose() is called
host = null;
}
catch { }
catch (Exception e)
{
WriteLog(e.ToString(), EventLogEntryType.Error);
}
}
}
}