mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-17 08:45:55 +01:00
c447f76122
7f850ebc Changed filename format strategy. Added JSONL appender. 7bb1d86a Support for Delphi 12 Athens git-subtree-dir: lib/loggerpro git-subtree-split: 7f850ebc12fcca4b2484c8269b3d0f36864a374e
43 lines
850 B
ObjectPascal
43 lines
850 B
ObjectPascal
unit LoggerProConfig;
|
|
|
|
interface
|
|
|
|
uses
|
|
LoggerPro,
|
|
LoggerPro.Proxy;
|
|
|
|
function Log: ILogWriter;
|
|
|
|
implementation
|
|
|
|
uses
|
|
LoggerPro.FileAppender, LoggerPro.JSONLFileAppender, System.SysUtils;
|
|
|
|
var
|
|
_Log: ILogWriter;
|
|
|
|
function Log: ILogWriter;
|
|
begin
|
|
Result := _Log;
|
|
end;
|
|
|
|
initialization
|
|
|
|
// The TLoggerProFileAppender has its defaults defined as follows:
|
|
// TLoggerProJSONLFileAppender = '{module}.{number}.{tag}.log';
|
|
// DEFAULT_MAX_BACKUP_FILE_COUNT = 5;
|
|
// DEFAULT_MAX_FILE_SIZE_KB = 1000;
|
|
|
|
// Creates logs in the ..\logs folder without PID in the filename
|
|
_Log := BuildLogWriter([
|
|
TLoggerProJSONLFileAppender.Create(10, 5, '..\logs', [],
|
|
{ default filename format}
|
|
//TLoggerProJSONLFileAppender.DEFAULT_FILENAME_FORMAT,
|
|
{ filename format including pid }
|
|
'{module}.{pid}.{number}.log',
|
|
TEncoding.UTF8
|
|
)
|
|
]);
|
|
|
|
end.
|