Class MemoryLogSink
- Namespace
- FlowGraph.Core.Diagnostics
- Assembly
- FlowGraph.Core.dll
Log sink that stores entries in memory for retrieval. Useful for displaying logs in UI or testing.
public sealed class MemoryLogSink : ILogSink
- Inheritance
-
MemoryLogSink
- Implements
- Inherited Members
Constructors
MemoryLogSink(int)
Creates a new memory log sink.
public MemoryLogSink(int maxEntries = 1000)
Parameters
maxEntriesintMaximum number of entries to keep (default: 1000).
Properties
Name
Gets the name of this sink for identification purposes.
public string Name { get; }
Property Value
Methods
Clear()
Clears all stored log entries.
public void Clear()
Flush()
Flushes any buffered log entries.
public void Flush()
GetEntries()
Gets all stored log entries.
public IReadOnlyList<LogEntry> GetEntries()
Returns
Write(LogEntry)
Writes a log entry to this sink.
public void Write(LogEntry entry)
Parameters
entryLogEntryThe log entry to write.
Events
EntryAdded
Event raised when a new log entry is added.
public event Action<LogEntry>? EntryAdded