YOUSEFUL / DELPHI / COMPONENTS
TAtlasLogLevel
The six log levels, from trace to fatal, plus llOff as a threshold.
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
| Member | Kind | What it does |
|---|---|---|
llTrace | value | The most detailed level: step-by-step tracing. |
llDebug | value | Diagnostic detail for developers. |
llInfo | value | Normal operation worth recording; the logger's default threshold. |
llWarning | value | Something unexpected that the program handled. |
llError | value | An operation failed; the default level of Failure and the console sink's default ErrorLevel. |
llFatal | value | The program cannot continue. |
llOff | value | A threshold only: nothing is ever logged at this level, and a MinLevel of llOff silences a logger or sink. |
Values
llTrace value
llTraceThe most detailed level: step-by-step tracing. Code TRC.
llDebug value
llDebugDiagnostic detail for developers. Code DBG.
llInfo value
llInfoNormal operation worth recording; the logger's default threshold. Code INF.
llWarning value
llWarningSomething unexpected that the program handled. Code WRN.
llError value
llErrorAn operation failed; the default level of Failure and the console sink's default ErrorLevel. Code ERR.
llFatal value
llFatalThe program cannot continue. Code FTL; the viewer draws it bold.
llOff value
llOffA 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.
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);
Related
TAtlasLogger · TAtlasLogSink · TAtlasLogEvent
Also in Atlas Log
TAtlasLogger · TAtlasMemorySink · TAtlasCallbackSink · TAtlasConsoleSink · TAtlasDebugSink · TAtlasFileSink · TAtlasAsyncSink · TAtlasLogView