log.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/protocol/log.h
  3. // Purpose: interface of wxProtocolLog
  4. // Author: Vadim Zeitlin
  5. // Created: 2009-03-06
  6. // Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
  7. // Licence: wxWindows licence
  8. ///////////////////////////////////////////////////////////////////////////////
  9. /**
  10. Class allowing to log network operations performed by wxProtocol.
  11. @library{wxnet}
  12. @category{net}
  13. @see wxProtocol
  14. */
  15. class wxProtocolLog
  16. {
  17. public:
  18. /**
  19. Create object doing the logging using wxLogTrace() with the specified
  20. trace mask.
  21. If you override DoLogString() in your class the @a traceMask may be
  22. left empty but it must have a valid value if you rely on the default
  23. DoLogString() implementation.
  24. */
  25. wxProtocolLog(const wxString& traceMask);
  26. /**
  27. Called by wxProtocol-derived objects to log strings sent to the server.
  28. Default implementation prepends a client-to-server marker to @a str and
  29. calls DoLogString().
  30. */
  31. virtual void LogRequest(const wxString& str);
  32. /**
  33. Called by wxProtocol-derived objects to log strings received from the
  34. server.
  35. Default implementation prepends a server-to-client marker to @a str and
  36. calls DoLogString().
  37. */
  38. virtual void LogResponse(const wxString& str);
  39. protected:
  40. /**
  41. Log the given string.
  42. This function is called from LogRequest() and LogResponse() and by
  43. default uses wxLogTrace() with the trace mask specified in the
  44. constructor but can be overridden to do something different by the
  45. derived classes.
  46. */
  47. virtual void DoLogString(const wxString& str);
  48. };