]> git.deb.at Git - rhonda/impostor.git/commitdiff
GameManager logging
authorAeonLucid <aeonlucid@gmail.com>
Sun, 20 Sep 2020 22:49:19 +0000 (00:49 +0200)
committerAeonLucid <aeonlucid@gmail.com>
Sun, 20 Sep 2020 22:49:19 +0000 (00:49 +0200)
src/AmongUs.Server/Net/GameManager.cs

index 0c2bc400709b75de101ce400704d311e69250706..e5d1949396fedae4a368bba14c24fe9dd32ad4a0 100644 (file)
@@ -1,17 +1,18 @@
 using System.Collections.Concurrent;
 using System.Security.Cryptography;
 using AmongUs.Shared.Innersloth;
+using Serilog;
 
 namespace AmongUs.Server.Net
 {
     public class GameManager
     {
-        private readonly RNGCryptoServiceProvider _random;
+        private static readonly ILogger Logger = Log.ForContext<GameManager>();
+        
         private readonly ConcurrentDictionary<int, Game> _games;
 
         public GameManager()
         {
-            _random = new RNGCryptoServiceProvider();
             _games = new ConcurrentDictionary<int, Game>();
         }
         
@@ -22,9 +23,11 @@ namespace AmongUs.Server.Net
 
             if (_games.TryAdd(gameCode, game))
             {
+                Logger.Debug("Created game with code {0} ({1}).", GameCode.IntToGameName(gameCode), gameCode);        
                 return game;
             }
 
+            Logger.Warning("Failed to create game.");
             return null;
         }
 
@@ -36,6 +39,7 @@ namespace AmongUs.Server.Net
 
         public void Remove(int gameCode)
         {
+            Logger.Debug("Remove game with code {0} ({1}).", GameCode.IntToGameName(gameCode), gameCode);   
             _games.TryRemove(gameCode, out _);
         }
     }