mirror of
https://github.com/danieleteti/delphimvcframework.git
synced 2024-11-17 16:55:54 +01:00
55500acdf9
git-subtree-dir: lib/loggerpro git-subtree-split: d1e0db6e93724e5fd825f0a8c02151d60450f98f
48 lines
809 B
ObjectPascal
48 lines
809 B
ObjectPascal
unit LoggerProConfig;
|
|
|
|
interface
|
|
|
|
uses
|
|
LoggerPro;
|
|
|
|
function Log: ILogWriter;
|
|
|
|
implementation
|
|
|
|
uses
|
|
LoggerPro.RedisAppender, Redis.Client, WinApi.Windows;
|
|
|
|
var
|
|
_Log: ILogWriter;
|
|
_Events: TLoggerProEventsHandler;
|
|
|
|
function Log: ILogWriter;
|
|
begin
|
|
Result := _Log;
|
|
end;
|
|
|
|
initialization
|
|
|
|
_Events := TLoggerProEventsHandler.Create;
|
|
_Events.OnAppenderError := procedure(
|
|
const AppenderClassName: string;
|
|
const aFailedLogItem: TLogItem;
|
|
const Reason: TLogErrorReason;
|
|
var Action: TLogErrorAction)
|
|
begin
|
|
Action := TLogErrorAction.SkipNewest;
|
|
WinApi.Windows.Beep(800, 500);
|
|
end;
|
|
|
|
DefaultLoggerProAppenderQueueSize := 10;
|
|
_Log := BuildLogWriter([
|
|
TLoggerProRedisAppender.Create(TRedisClient.Create('127.0.0.1', 6379))
|
|
], _Events);
|
|
|
|
finalization
|
|
|
|
_Log := nil;
|
|
_Events.Free;
|
|
|
|
end.
|