danieleteti/loggerpro

File.Appender error?

cefamax opened this issue · 3 comments

hi, in LoggerPro.FileAppender.pas in the constructor procedure

constructor TLoggerProFileAppenderBase.Create(aMaxBackupFileCount: Integer; aMaxFileSizeInKiloByte: Integer; aLogsFolder: string;
  aFileAppenderOptions: TFileAppenderOptions; aLogFileNameFormat: string; aLogFormat: string; aEncoding: TEncoding);
begin
  inherited Create(ALogFormat);
  fLogsFolder := aLogsFolder;  
  fMaxBackupFileCount:= Min(1, aMaxBackupFileCount);
  fMaxFileSizeInKiloByte := aMaxFileSizeInKiloByte;
  fLogFileNameFormat := aLogFileNameFormat;
  fFileAppenderOptions := aFileAppenderOptions;
  if Assigned(aEncoding) then
    fEncoding := aEncoding
  else
    fEncoding := TEncoding.DEFAULT;
end;

I think there is an error in the line
fMaxBackupFileCount:= Min(1, aMaxBackupFileCount);

in this case fMaxBackupFileCount can never be higher than 1.

I think it is more correct:
fMaxBackupFileCount:= Max(1, aMaxBackupFileCount);

thanks a lot for this library.

Duplicate of #61

@danieleteti can you close the two issues please? I don't have the permissions to do so.