<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />

MemoryTraceWriter

Represents a trace writer that writes to memory. When the trace message limit is reached then old trace messages will be removed as new messages are added.
public TraceLevel LevelFilter { get; set; }

Gets the TraceLevel that will be used to filter the trace messages passed to the writer. For example a filter level of Info will exclude Verbose messages and include Info, Warning and Error messages.

Initializes a new instance of the MemoryTraceWriter class.

public IEnumerable<string> GetTraceMessages()

Returns an enumeration of the most recent trace messages.

public void Trace(TraceLevel level, string message, Exception ex)

Writes the specified trace level, message and optional exception.