anchor.diff:    TFileAppenderOptions = set of TFileAppenderOption;
   
     { @abstract(The base class for different file appenders)
  -    Do not use this class directly, but one of TLoggerProFileAppender or TLoggerProFilteringFileAppender.
  +    Do not use this class directly, but one of TLoggerProFileAppender or TLoggerProSimpleFileAppender.
       Check the sample @code(file_appender.dproj)
     }
     TLoggerProFileAppenderBase = class(TLoggerProAppenderBase)
  
positive.code:   end;
  
    { @abstract(A filtering file appender)
      This file appender filters the TLogItems with the given tags and writes them into a single log file.
      If the filter array is empty, all TLogItems will be written into this file.
      To learn how to use this appender, check the sample @code(file_appender.dproj)
    }
    TLoggerProFilteringFileAppender = class(TLoggerProFileAppenderBase)
    private const
      cDefaultLogTag = '----';
    private
      fFilterWriter: TStreamWriter;
      fFileNameTag: string;
      fLogTags: array of string;
      procedure RotateLog;
    public
      constructor Create(
        aLogTags: array of string;
        const aFileNameTag: string = cDefaultLogTag;
        aMaxBackupFileCount: Integer = TLoggerProFileAppenderBase.DEFAULT_MAX_BACKUP_FILE_COUNT;
        aMaxFileSizeInKiloByte: Integer = TLoggerProFileAppenderBase.DEFAULT_MAX_FILE_SIZE_KB;
        aLogsFolder: string = '';
        aFileAppenderOptions: TFileAppenderOptions = [];
        aLogFileNameFormat: string = TLoggerProFileAppenderBase.DEFAULT_FILENAME_FORMAT;
        aLogFormat: string = DEFAULT_LOG_FORMAT;
        aEncoding: TEncoding = nil);
        reintroduce;
      procedure Setup; override;
      procedure TearDown; override;
      procedure WriteLog(const aLogItem: TLogItem); overload; override;
  
negative.code:   end;
  end;
  
  { TLoggerProSimpleFileAppender }
  
  procedure TLoggerProSimpleFileAppender.RotateLog;
  var
    lLogFileName: string;
  begin
    WriteToStream(fFileWriter, '#[ROTATE LOG ' + datetimetostr(Now, FormatSettings) + ']');
    // remove the writer during rename
    fFileWriter.Free;
    RotateFile(cDefaultLogTag, lLogFileName);
    // re-create the writer
    fFileWriter := CreateWriter(GetLogFileName(cDefaultLogTag, 0));
    WriteToStream(fFileWriter, '#[START LOG ' + datetimetostr(Now, FormatSettings) + ']');
  end;
  
  procedure TLoggerProSimpleFileAppender.Setup;
  begin
    inherited;
    fFileWriter := CreateWriter(GetLogFileName(cDefaultLogTag, 0));
  end;
  
  procedure TLoggerProSimpleFileAppender.TearDown;
  begin
    fFileWriter.Free;
    inherited;
  end;
  
  procedure TLoggerProSimpleFileAppender.WriteLog(const aLogItem: TLogItem);
  begin
    InternalWriteLog(fFileWriter, aLogItem);
  
    if fFileWriter.BaseStream.Size > fMaxFileSizeInKiloByte * 1024 then
    begin
      RotateLog;
    end;
  end;
  
  end.
  