← All source files

V18 / 8d896b8a86e5

LoggerSubscription.cs

Lilith/Core/Logging/LoggerSubscription.cs

Unchanged from the preceding version
CS
namespace Lilith.Core.Logging;

internal sealed class LoggerSubscription(Logger logger, Action<LogEntry> handler) : IDisposable
{
    private int _disposed;

    public void Dispose()
    {
        if (Interlocked.Exchange(ref _disposed, 1) == 1)
        {
            return;
        }

        logger.Unsubscribe(handler);
    }
}