Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File.Appender error? #64

Closed
cefamax opened this issue Dec 13, 2022 · 3 comments
Closed

File.Appender error? #64

cefamax opened this issue Dec 13, 2022 · 3 comments

Comments

@cefamax
Copy link

cefamax commented Dec 13, 2022

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
Copy link
Contributor

luebbe commented Dec 14, 2022

Duplicate of #61

luebbe added a commit to luebbe/loggerpro that referenced this issue Dec 14, 2022
danieleteti added a commit that referenced this issue Dec 14, 2022
@luebbe
Copy link
Contributor

luebbe commented Dec 14, 2022

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

@cefamax
Copy link
Author

cefamax commented Dec 14, 2022

@danieleteti and @luebbe
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants