diff --git a/src/GameServiceWarden.Core/Logging/Logger.cs b/src/GameServiceWarden.Core/Logging/Logger.cs index c84a9e4..6dc23b1 100644 --- a/src/GameServiceWarden.Core/Logging/Logger.cs +++ b/src/GameServiceWarden.Core/Logging/Logger.cs @@ -1,10 +1,11 @@ using System; +using System.Collections.Concurrent; using System.Collections.Generic; namespace GameServiceWarden.Core.Logging { public static class Logger { - private static readonly Dictionary listeners = new Dictionary(); + private static readonly ConcurrentDictionary listeners = new ConcurrentDictionary(); /// /// Logs the message to listeners that are listening to the set severity of the message or greater. @@ -33,7 +34,8 @@ namespace GameServiceWarden.Core.Logging /// /// The listener to remove. public static void RemoveLogListener(ILogReceiver listener) { - listeners.Remove(listener.Identifier); + ILogReceiver receiver; + listeners.TryRemove(listener.Identifier, out receiver); } ///