danieleteti / loggerpro

An modern and pluggable logging framework for Delphi
Apache License 2.0
352 stars 91 forks source link

File.Appender error? #64

Closed cefamax closed 1 year ago

cefamax commented 1 year ago

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.

luebbe commented 1 year ago

Duplicate of #61

luebbe commented 1 year ago

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

cefamax commented 1 year ago

@danieleteti and @luebbe Thanks