anchor.diff:    TKMLog = class
     private
       CS: TCriticalSection;
  -    fl: textfile;
  +    fLogFile: TextFile;
       fLogPath: UnicodeString;
       fFirstTick: cardinal;
       fPreviousTick: cardinal;
  
positive.code:   try
      ForceDirectories(ExtractFilePath(fLogPath));
  
      AssignFile(fl, fLogPath);
      Rewrite(fl);
      //           hh:nn:ss.zzz 12345.678s 1234567ms     text-text-text
      WriteLn(fl, '   Timestamp    Elapsed     Delta     Description');
      CloseFile(fl);
    except
      on Ex: Exception do
      begin
  
negative.code:     if not FileExists(fLogPath) then
        InitLog;  // Recreate log file, if it was deleted
  
      Append(fLogFile);
      //Write a line when the day changed since last time (useful for dedicated server logs that could be over months)
      if Abs(Trunc(fPreviousDate) - Trunc(Now)) >= 1 then
      begin
        WriteLn(fLogFile, '========================');
        WriteLn(fLogFile, '    Date: ' + FormatDateTime('yyyy/mm/dd', Now));
        WriteLn(fLogFile, '========================');
      end;
      WriteLn(fLogFile, Format('%12s %9.3fs %7dms     %s', [
                    FormatDateTime('hh:nn:ss.zzz', Now),
                    TimeSince(fFirstTick) / 1000,
                    TimeSince(fPreviousTick),
                    aText]));
  
      if aDoCloseFile then
        CloseFile(fLogFile);
  
      fPreviousTick := TimeGet;
      fPreviousDate := Now;
  