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:     LogThread.PostToThreadMessage(WM_ERASE, 0, 0);
  end;
  
  function InitLogs: boolean;
  begin
      WLogFileName := ChangeFileExt(ParamStr(0), '.log');
  
negative.code: function PostToLog(const ADateTime: TDateTime; const Text: string; const Level: TLogLevel): boolean; overload;
  function PostToLog(const ADateTime: TDateTime; const Text: string; const AClear: boolean; const Level: TLogLevel): boolean; overload;
  procedure EraseLog;
  procedure TruncateLog(const AMaxSize: longint);
  
  implementation
  
  uses StrUtils, SysUtils, WThread;
  
  const
      WM_LOG      = WM_WTHREAD_BASE + 1;
      WM_ERASE    = WM_WTHREAD_BASE + 2;
      WM_TRUNC		= WM_WTHREAD_BASE + 3;
  
  type
      PLogRecord = ^TLogRecord;
  