IdLogStream.pas 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. { $HDR$}
  2. {**********************************************************************}
  3. { Unit archived using Team Coherence }
  4. { Team Coherence is Copyright 2002 by Quality Software Components }
  5. { }
  6. { For further information / comments, visit our WEB site at }
  7. { http://www.TeamCoherence.com }
  8. {**********************************************************************}
  9. {}
  10. { $Log: 10239: IdLogStream.pas
  11. {
  12. { Rev 1.0 2002.11.12 10:44:38 PM czhower
  13. }
  14. unit IdLogStream;
  15. interface
  16. uses classes, IdLogBase;
  17. type
  18. TIdLogStream = class(TIdLogBase)
  19. protected
  20. FInputStream : TStream;
  21. FOutputStream : TStream;
  22. procedure LogStatus(const AText: string); override;
  23. procedure LogReceivedData(const AText: string; const AData: string); override;
  24. procedure LogSentData(const AText: string; const AData: string); override;
  25. public
  26. property InputStream : TStream read FInputStream write FInputStream;
  27. property OutputStream : TStream read FOutputStream write FOutputStream;
  28. end;
  29. implementation
  30. { TIdLogStream }
  31. procedure TIdLogStream.LogReceivedData(const AText, AData: string);
  32. begin
  33. if (Assigned(FInputStream)) and (Length(AData)>0) then
  34. begin
  35. FInputStream.Write(AData[1],Length(AData));
  36. end;
  37. end;
  38. procedure TIdLogStream.LogSentData(const AText, AData: string);
  39. begin
  40. if (Assigned(FOutputStream)) and (Length(AData)>0) then
  41. begin
  42. FOutputStream.Write(AData[1],Length(AData));
  43. end;
  44. end;
  45. procedure TIdLogStream.LogStatus(const AText: string);
  46. begin
  47. //we just leave this empty because the AText is not part of the stream and we don't {Do not Localize}
  48. //want to raise an abstract method exception.
  49. end;
  50. end.