delphimvcframework/samples/20_multiple_loggers/LoggerProConfig.pas
Daniele Teti b22a41ca91 Squashed 'lib/loggerpro/' changes from 7f850ebc..0b6857bd
0b6857bd Updated unit tests and automatic tasks
35d130d6 VERSION_1_4_4
2e4a80f4 Removed PasDoc documentation; Added unit tests for LogLayoutToLogFormat
8f61bc22 Removed TLogAppenderOptions, DEFAULT_LOG_FILENAME_FORMAT is now TLogLayout.* (there many possibilities); FileName layout use placeholders instead of indices (as format function does).
be43f781 Merge branch 'master' into v2.0

git-subtree-dir: lib/loggerpro
git-subtree-split: 0b6857bd8d51f5acb246561564b3c3bbd963d192
2024-01-02 16:30:52 +01:00

41 lines
678 B
ObjectPascal

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);
// only warnings, errors or fatals on outputdebugstring
_Log.Appenders[2].SetLogLevel(TLogType.Warning);
end;
initialization
SetupLogger;
end.