mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-17 00:35:55 +01:00
41 lines
678 B
ObjectPascal
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.
|