mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-17 08:45:55 +01:00
55500acdf9
git-subtree-dir: lib/loggerpro git-subtree-split: d1e0db6e93724e5fd825f0a8c02151d60450f98f
46 lines
872 B
ObjectPascal
46 lines
872 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;
|
|
var
|
|
lFileAppender, lErrorsFileAppender, lOutputDebugStringAppender: ILogAppender;
|
|
begin
|
|
lFileAppender := TLoggerProFileAppender.Create(5, 1000, 'logs');
|
|
lFileAppender.SetLogLevel(TLogType.Info);
|
|
|
|
lErrorsFileAppender := TLoggerProFileAppender.Create(5, 1000, 'logs_errors');
|
|
lErrorsFileAppender.SetLogLevel(TLogType.Error);
|
|
|
|
lOutputDebugStringAppender := TLoggerProOutputDebugStringAppender.Create;
|
|
// default TLogType.Debug
|
|
|
|
_Log := BuildLogWriter([lFileAppender, lErrorsFileAppender, lOutputDebugStringAppender]);
|
|
end;
|
|
|
|
initialization
|
|
|
|
SetupLogger;
|
|
|
|
end.
|