Class LogRingBuffer
In-memory circular buffer for recent log entries.
Each entry gets a monotonic ID for incremental fetch.
Thread-safe via lock. Capacity configured by Tsak:Logs:BufferSize.
public sealed class LogRingBuffer
Inheritance
Properties
Capacity
public int Capacity { get; }
Count
public int Count { get; }
Methods
Add(DateTimeOffset, string, string, string?, string?)
Add entry with auto-assigned ID.
public void Add(DateTimeOffset timestamp, string level, string message, string? source, string? exception)
GetAfter(long, int, string?)
Get entries newer than afterId (oldest first). Supports level filter.
public IReadOnlyList<LogEntry> GetAfter(long afterId, int limit = 500, string? levelFilter = null)
GetBefore(long, int, string?)
Get entries older than beforeId, newest first: the page that precedes one already shown
public IReadOnlyList<LogEntry> GetBefore(long beforeId, int limit = 200, string? levelFilter = null)
GetRecent(int, string?)
Get most recent entries, newest first. Optional limit and level filter.
public IReadOnlyList<LogEntry> GetRecent(int limit = 100, string? levelFilter = null)