2023-02-27 12:26:25 +01:00
|
|
|
unit LoggerProConfig;
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
uses
|
|
|
|
LoggerPro;
|
|
|
|
|
|
|
|
function Log: ILogWriter;
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
uses
|
|
|
|
LoggerPro.FileAppender,
|
|
|
|
LoggerPro.ConsoleAppender,
|
|
|
|
LoggerPro.OutputDebugStringAppender;
|
|
|
|
|
|
|
|
var
|
|
|
|
_Log: ILogWriter;
|
|
|
|
|
|
|
|
function Log: ILogWriter;
|
|
|
|
begin
|
|
|
|
Result := _Log;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure SetupLogger;
|
|
|
|
begin
|
|
|
|
_Log := BuildLogWriter([TLoggerProFileAppender.Create,
|
|
|
|
TLoggerProConsoleAppender.Create,
|
|
|
|
TLoggerProOutputDebugStringAppender.Create]);
|
|
|
|
// only errors on console
|
|
|
|
_Log.Appenders[1].SetLogLevel(TLogType.Error);
|
2024-01-02 16:30:52 +01:00
|
|
|
// only warnings, errors or fatals on outputdebugstring
|
2023-02-27 12:26:25 +01:00
|
|
|
_Log.Appenders[2].SetLogLevel(TLogType.Warning);
|
|
|
|
end;
|
|
|
|
|
|
|
|
initialization
|
|
|
|
|
|
|
|
SetupLogger;
|
|
|
|
|
|
|
|
end.
|