MsgLen := MsgLen + SizeOf(MsgDesc.Annex) + SizeOf(DWORD);
MsgDesc.Length := MsgLen;
end;
begin
if FAutoStart and not FIgnoreViewer and not FViewerAutoStartCalled then
begin
StartDebugViewer;
FViewerAutoStartCalled := True;
end;
Inc(FMessageCount);
if not CheckEnabled then Exit;
FChannelReady := FChannel.CheckReady;
if (not FChannelReady) and (not FDumpToFile) then Exit;
GenerateMsgDesc;
if FChannelReady then
begin
if FChannel.CheckFilterChanged then
FChannel.RefreshFilter(FFilter);
if CheckFiltered(string(ATag), ALevel, AType) then
InternalOutput(MsgDesc, MsgLen);
end;
// 同时 DumpToFile
if FDumpToFile and not FIgnoreViewer and (FDumpFile <> nil) then
begin
if not FAfterFirstWrite then // 第一回写时需要判断是否重写
begin
if FUseAppend then
FDumpFile.Seek(0, soFromEnd)
else
begin
FDumpFile.Size := 0;
FDumpFile.Seek(0, soFromBeginning);
end;
FAfterFirstWrite := True; // 后续写就无需判断了
end;
procedure DoInternalOutputMsg;
begin
if FAutoStart and not FIgnoreViewer and not FViewerAutoStartCalled then
begin
StartDebugViewer;
FViewerAutoStartCalled := True;
end;
Inc(FMessageCount);
if not CheckEnabled then
Exit;
if not FChannel.CheckReady and not FDumpToFile then
Exit;
while LeftSize > 0 do
begin
GenerateMsgDesc;
if FChannel.CheckReady then
begin
if FChannel.CheckFilterChanged then
FChannel.RefreshFilter(FFilter);
if CheckFiltered(string(ATag), ALevel, AType) then
InternalOutput(MsgDesc, MsgLen);
end;
// 同时 DumpToFile
if FDumpToFile and not FIgnoreViewer and (FDumpFile <> nil) then
begin
if not FAfterFirstWrite then // 第一回写时需要判断是否重写
begin
if FUseAppend then
FDumpFile.Seek(0, soFromEnd)
else
begin
FDumpFile.Size := 0;
FDumpFile.Seek(0, soFromBeginning);
end;
FAfterFirstWrite := True; // 后续写就无需判断了
end;