YOUSEFUL / DELPHI / COMPONENTS
TAtlasLogFormatter
The abstract base of the formatters: one event in, one line of text out.
Description
Implemented by TAtlasTextFormatter and TAtlasJsonFormatter. Write code against it to accept either.
Members
| Member | Kind | What it does |
|---|---|---|
Format | method | The event as one line, without a line break at the end. |
Methods
Format method
function Format(const Event: TAtlasLogEvent): string; virtual; abstract;The event as one line, without a line break at the end.
Examples
Format a snapshot either way
The caller chooses text or JSON.
uses Atlas.Log, Atlas.LogFormat;
function FormatAll(const Events: TArray<TAtlasLogEvent>; Formatter: TAtlasLogFormatter): TArray<string>;
var
I: Integer;
begin
SetLength(Result, Length(Events));
for I := 0 to High(Events) do Result[I] := Formatter.Format(Events[I]);
end;
Related
TAtlasTextFormatter · TAtlasJsonFormatter
Also in Atlas Log
TAtlasLogger · TAtlasMemorySink · TAtlasCallbackSink · TAtlasConsoleSink · TAtlasDebugSink · TAtlasFileSink · TAtlasAsyncSink · TAtlasLogView