IdLogEvent.pas 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. {
  2. $Project$
  3. $Workfile$
  4. $Revision$
  5. $DateUTC$
  6. $Id$
  7. This file is part of the Indy (Internet Direct) project, and is offered
  8. under the dual-licensing agreement described on the Indy website.
  9. (http://www.indyproject.org/)
  10. Copyright:
  11. (c) 1993-2005, Chad Z. Hower and the Indy Pit Crew. All rights reserved.
  12. }
  13. {
  14. $Log$
  15. }
  16. {
  17. Rev 1.2 2004.05.20 12:34:28 PM czhower
  18. Removed more non .NET compatible stream read and writes
  19. Rev 1.1 2003.10.17 8:17:22 PM czhower
  20. Removed const
  21. Rev 1.0 11/13/2002 07:56:08 AM JPMugaas
  22. }
  23. unit IdLogEvent;
  24. interface
  25. {$I IdCompilerDefines.inc}
  26. //Put FPC into Delphi mode
  27. uses
  28. IdLogBase, Classes;
  29. type
  30. TLogItemStatusEvent = procedure(ASender: TComponent; const AText: string) of object;
  31. TLogItemDataEvent = procedure(ASender: TComponent; const AText, AData: string) of object;
  32. TIdLogEvent = class(TIdLogBase)
  33. protected
  34. FOnReceived: TLogItemDataEvent;
  35. FOnSent: TLogItemDataEvent;
  36. FOnStatus: TLogItemStatusEvent;
  37. //
  38. procedure LogStatus(const AText: string); override;
  39. procedure LogReceivedData(const AText, AData: string); override;
  40. procedure LogSentData(const AText, AData: string); override;
  41. public
  42. published
  43. property OnReceived: TLogItemDataEvent read FOnReceived write FOnReceived;
  44. property OnSent: TLogItemDataEvent read FOnSent write FOnSent;
  45. property OnStatus: TLogItemStatusEvent read FOnStatus write FOnStatus;
  46. end;
  47. implementation
  48. { TIdLogEvent }
  49. procedure TIdLogEvent.LogReceivedData(const AText, AData: string);
  50. begin
  51. if Assigned(OnReceived) then begin
  52. OnReceived(Self, AText, AData);
  53. end;
  54. end;
  55. procedure TIdLogEvent.LogSentData(const AText, AData: string);
  56. begin
  57. if Assigned(OnSent) then begin
  58. OnSent(Self, AText, AData);
  59. end;
  60. end;
  61. procedure TIdLogEvent.LogStatus(const AText: string);
  62. begin
  63. if Assigned(OnStatus) then begin
  64. OnStatus(Self, AText);
  65. end;
  66. end;
  67. end.