From 83e2d37f4144f08f76a48d23fd3abbbc31deb805 Mon Sep 17 00:00:00 2001 From: EonaCat Date: Fri, 25 Apr 2025 21:51:33 +0200 Subject: [PATCH] Updated --- .../EonaCatCoreLogger/LogContext.cs | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) 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; + } } }