mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-16 16:25:54 +01:00
61 lines
1.6 KiB
ObjectPascal
61 lines
1.6 KiB
ObjectPascal
unit LoggerProConfig;
|
|
|
|
interface
|
|
|
|
uses
|
|
LoggerPro;
|
|
|
|
function Log: ILogWriter;
|
|
|
|
implementation
|
|
|
|
uses
|
|
LoggerPro.FileAppender;
|
|
|
|
var
|
|
_Log: ILogWriter;
|
|
|
|
function Log: ILogWriter;
|
|
begin
|
|
Result := _Log;
|
|
end;
|
|
|
|
initialization
|
|
|
|
{ The TLoggerProFileAppender has its defaults defined as follows:
|
|
DEFAULT_LOG_FORMAT = '%0:s [TID %1:-8d][%2:-10s] %3:s [%4:s]';
|
|
DEFAULT_MAX_BACKUP_FILE_COUNT = 5;
|
|
DEFAULT_MAX_FILE_SIZE_KB = 1000;
|
|
|
|
You can override these dafaults passing parameters to the constructor.
|
|
Here's some configuration examples:
|
|
@longcode(#
|
|
// Creates log in the same exe folder without PID in the filename
|
|
_Log := BuildLogWriter([TLoggerProFileAppender.Create(10, 5,
|
|
[TFileAppenderOption.LogsInTheSameFolder])]);
|
|
|
|
// Creates log in the AppData/Roaming with PID in the filename
|
|
_Log := BuildLogWriter([TLoggerProFileAppender.Create(10, 5,
|
|
[TFileAppenderOption.IncludePID])]);
|
|
|
|
// Creates log in the same folder with PID in the filename
|
|
_Log := BuildLogWriter([TLoggerProFileAppender.Create(10, 5,
|
|
[TFileAppenderOption.IncludePID])]);
|
|
#)
|
|
}
|
|
|
|
// Creates log in the ..\..\ folder without PID in the filename
|
|
_Log := BuildLogWriter([TLoggerProFileAppender.Create(10, 5, '..\..',[TFileAppenderOption.IncludePID])]);
|
|
// Create logs in the exe' same folder
|
|
// _Log := BuildLogWriter([TLoggerProFileAppender.Create(10, 5)]);
|
|
|
|
// Creates log in the AppData/Roaming with PID in the filename
|
|
// _Log := BuildLogWriter([TLoggerProFileAppender.Create(10, 5,
|
|
// [TFileAppenderOption.IncludePID])]);
|
|
|
|
// Creates log in the same folder with PID in the filename
|
|
// _Log := BuildLogWriter([TLoggerProFileAppender.Create(10, 5,
|
|
// [TFileAppenderOption.IncludePID])]);
|
|
|
|
end.
|