]> git.deb.at Git - rhonda/impostor.git/commitdiff
Fixes #151 - Program argument to enable with verbose logging
authorAeonLucid <aeonlucid@outlook.com>
Sun, 15 Nov 2020 03:17:16 +0000 (04:17 +0100)
committerAeonLucid <aeonlucid@outlook.com>
Sun, 15 Nov 2020 03:17:16 +0000 (04:17 +0100)
src/Impostor.Server/Program.cs

index 5c0d6eb767c04b45ea1ec17fb77f0437dd7fad67..c1e694729a65ad628187702bab528c7ce43e1e81 100644 (file)
@@ -1,5 +1,6 @@
 using System;
 using System.IO;
+using System.Linq;
 using Impostor.Api.Events.Managers;
 using Impostor.Api.Games;
 using Impostor.Api.Games.Managers;
@@ -29,12 +30,22 @@ namespace Impostor.Server
     {
         private static int Main(string[] args)
         {
+#if DEBUG
+            var logLevel = LogEventLevel.Debug;
+#else
+            var logLevel = LogEventLevel.Information;
+#endif
+
+            if (args.Contains("--verbose"))
+            {
+                logLevel = LogEventLevel.Verbose;
+            }
+
             Log.Logger = new LoggerConfiguration()
+                .MinimumLevel.Is(logLevel)
 #if DEBUG
-                .MinimumLevel.Verbose()
                 .MinimumLevel.Override("Microsoft", LogEventLevel.Debug)
 #else
-                .MinimumLevel.Information()
                 .MinimumLevel.Override("Microsoft", LogEventLevel.Information)
 #endif
                 .Enrich.FromLogContext()