YOUSEFUL / DELPHI / COMPONENTS

TAtlasLogLevel

The six log levels, from trace to fatal, plus llOff as a threshold.

Enumeration Unit Atlas.Log · Product Atlas Log

Description

Levels are ordered, so thresholds compare with >=. The constant arrays AtlasLevelNames ('trace', 'debug', 'info', 'warning', 'error', 'fatal', 'off') and AtlasLevelCodes ('TRC', 'DBG', 'INF', 'WRN', 'ERR', 'FTL', 'OFF') in Atlas.Log give the text used by the {level} and {level:short} tokens and the JSON level member.

Members

MemberKindWhat it does
llTracevalueThe most detailed level: step-by-step tracing.
llDebugvalueDiagnostic detail for developers.
llInfovalueNormal operation worth recording; the logger's default threshold.
llWarningvalueSomething unexpected that the program handled.
llErrorvalueAn operation failed; the default level of Failure and the console sink's default ErrorLevel.
llFatalvalueThe program cannot continue.
llOffvalueA threshold only: nothing is ever logged at this level, and a MinLevel of llOff silences a logger or sink.

Values

llTrace value

llTrace

The most detailed level: step-by-step tracing. Code TRC.

llDebug value

llDebug

Diagnostic detail for developers. Code DBG.

llInfo value

llInfo

Normal operation worth recording; the logger's default threshold. Code INF.

llWarning value

llWarning

Something unexpected that the program handled. Code WRN.

llError value

llError

An operation failed; the default level of Failure and the console sink's default ErrorLevel. Code ERR.

llFatal value

llFatal

The program cannot continue. Code FTL; the viewer draws it bold.

llOff value

llOff

A threshold only: nothing is ever logged at this level, and a MinLevel of llOff silences a logger or sink.

Examples

A level from a command-line switch

Configuration files are not implemented; this maps a name or code to a level.

pascal
uses System.SysUtils, Atlas.Log;

function LevelFromText(const Text: string; Default: TAtlasLogLevel): TAtlasLogLevel;
var
  Level: TAtlasLogLevel;
begin
  for Level := Low(TAtlasLogLevel) to High(TAtlasLogLevel) do
    if SameText(AtlasLevelNames[Level], Text) or SameText(AtlasLevelCodes[Level], Text) then Exit(Level);
  Result := Default;
end;

// AtlasLog.MinLevel := LevelFromText('debug', llInfo);

TAtlasLogger · TAtlasLogSink · TAtlasLogEvent

Also in Atlas Log

TAtlasLogger · TAtlasMemorySink · TAtlasCallbackSink · TAtlasConsoleSink · TAtlasDebugSink · TAtlasFileSink · TAtlasAsyncSink · TAtlasLogView