Table of Contents

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

maxEntries int

Maximum number of entries to keep (default: 1000).

Properties

Name

Gets the name of this sink for identification purposes.

public string Name { get; }

Property Value

string

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

IReadOnlyList<LogEntry>

Write(LogEntry)

Writes a log entry to this sink.

public void Write(LogEntry entry)

Parameters

entry LogEntry

The log entry to write.

Events

EntryAdded

Event raised when a new log entry is added.

public event Action<LogEntry>? EntryAdded

Event Type

Action<LogEntry>