diff --git a/src/Tgstation.Server.Host.Service/Program.cs b/src/Tgstation.Server.Host.Service/Program.cs
index 5944978b4d..69db326c2f 100644
--- a/src/Tgstation.Server.Host.Service/Program.cs
+++ b/src/Tgstation.Server.Host.Service/Program.cs
@@ -33,6 +33,18 @@ namespace Tgstation.Server.Host.Service
[Option(ShortName = "i")]
public bool Install { get; set; }
+ ///
+ /// The --trace or -t option. Enables trace logs
+ ///
+ [Option(ShortName = "t")]
+ public bool Trace { get; set; }
+
+ ///
+ /// The --debug or -d option. Enables debug logs
+ ///
+ [Option(ShortName = "d")]
+ public bool Debug { get; set; }
+
///
/// Check if the running user is a system administrator
///
@@ -109,7 +121,7 @@ namespace Tgstation.Server.Host.Service
}
else
using (var loggerFactory = new LoggerFactory())
- ServiceBase.Run(new ServerService(new WatchdogFactory(), loggerFactory));
+ ServiceBase.Run(new ServerService(new WatchdogFactory(), loggerFactory, Trace ? LogLevel.Trace : Debug ? LogLevel.Debug : LogLevel.Information));
}
///
diff --git a/src/Tgstation.Server.Host.Service/ServerService.cs b/src/Tgstation.Server.Host.Service/ServerService.cs
index 58c923afe2..1f53f5e999 100644
--- a/src/Tgstation.Server.Host.Service/ServerService.cs
+++ b/src/Tgstation.Server.Host.Service/ServerService.cs
@@ -41,7 +41,8 @@ namespace Tgstation.Server.Host.Service
///
/// The to create with
/// The for
- public ServerService(IWatchdogFactory watchdogFactory, ILoggerFactory loggerFactory)
+ /// The minimum to record in the event log
+ public ServerService(IWatchdogFactory watchdogFactory, ILoggerFactory loggerFactory, LogLevel minumumLogLevel)
{
if (watchdogFactory == null)
throw new ArgumentNullException(nameof(watchdogFactory));
@@ -50,7 +51,8 @@ namespace Tgstation.Server.Host.Service
loggerFactory.AddEventLog(new EventLogSettings
{
- EventLog = this
+ EventLog = this,
+ Filter = (message, logLevel) => logLevel >= minumumLogLevel
});
ServiceName = Name;