← All source files

V2 / df3fc286644d

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);
    }
}