This commit is contained in:
2025-04-25 21:51:33 +02:00
parent ddbf482f6e
commit 83e2d37f41

View File

@@ -1,11 +1,18 @@
using System.Collections.Concurrent; using System;
using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
namespace EonaCat.Logger.EonaCatCoreLogger namespace EonaCat.Logger.EonaCatCoreLogger
{ {
public class LoggerScopedContext public class LoggerScopedContext : IDisposable
{ {
private readonly ConcurrentDictionary<string, string> _context = new(); private readonly ConcurrentDictionary<string, string> _context = new();
private readonly string _correlationId;
public LoggerScopedContext(string correlationId = null)
{
_correlationId = correlationId;
}
public void Set(string key, string value) public void Set(string key, string value)
{ {
@@ -26,5 +33,15 @@ namespace EonaCat.Logger.EonaCatCoreLogger
{ {
_context.Clear(); _context.Clear();
} }
public void Dispose()
{
Clear();
}
public IDisposable CreateScope()
{
return this;
}
} }
} }