anchor.diff:      FreeMem(p);
   end;
   
  +procedure TLogThread.WMTruncateLog(var Msg: TThreadMessage);
  +var f: File;
  +		need: boolean;
  +begin
  +    if FileOpened then
  +        FileOpened := not CloseLog;
  +    try
  +        if (not FileOpened) and (FileExists(WLogFileName)) then begin
  +            AssignFile(f, WLogFileName);
  +            Reset(f, 1);
  +            need := FileSize(f) >= Msg.LParam;
  +            CloseFile(f);
  +            if need then begin
  +								Rename(f, Copy(WLogFileName, 1, Length(WLogFileName)-4)+FormatDateTime('"_"yyyymmddhhnnss".log"', Now));
  +            end;
  +        end;
  +    except on e: exception do
  +
  +    end;
  +end;
  +
   procedure TLogThread.WMErase(var Msg: TThreadMessage);
   var f: File;
   begin
  
positive.code: 
  initialization
      FileOpened := false;
      WLogLevel := WLL_NORMAL; // default level
      WLogEnabled := InitLogs;
      FirstLine := true; // first write empty line
      WLogClearOnStart := true; // empty log on every start
  
  finalization
      DoneLogs;
  
negative.code: ﻿unit wlog;
  // wlog (c) wadman, 2015-2020, 22.01.2020
  // multithread safe logging
  
  interface
  