diff --git a/EonaCat.Logger/EonaCatCoreLogger/LogContext.cs b/EonaCat.Logger/EonaCatCoreLogger/LogContext.cs index 3acf2c1..44361e6 100644 --- a/EonaCat.Logger/EonaCatCoreLogger/LogContext.cs +++ b/EonaCat.Logger/EonaCatCoreLogger/LogContext.cs @@ -1,11 +1,18 @@ -using System.Collections.Concurrent; +using System; +using System.Collections.Concurrent; using System.Collections.Generic; namespace EonaCat.Logger.EonaCatCoreLogger { - public class LoggerScopedContext + public class LoggerScopedContext : IDisposable { private readonly ConcurrentDictionary _context = new(); + private readonly string _correlationId; + + public LoggerScopedContext(string correlationId = null) + { + _correlationId = correlationId; + } public void Set(string key, string value) { @@ -26,5 +33,15 @@ namespace EonaCat.Logger.EonaCatCoreLogger { _context.Clear(); } + + public void Dispose() + { + Clear(); + } + + public IDisposable CreateScope() + { + return this; + } } }