]> git.saurik.com Git - wxWidgets.git/blob - include/wx/protocol/log.h
props
[wxWidgets.git] / include / wx / protocol / log.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/protocol/log.h
3 // Purpose: wxProtocolLog class for logging network exchanges
4 // Author: Troelsk, Vadim Zeitlin
5 // Created: 2009-03-06
6 // RCS-ID: $Id$
7 // Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_PROTOCOL_LOG_H_
12 #define _WX_PROTOCOL_LOG_H_
13
14 #include "wx/string.h"
15
16 // ----------------------------------------------------------------------------
17 // wxProtocolLog: simple class for logging network requests and responses
18 // ----------------------------------------------------------------------------
19
20 class WXDLLIMPEXP_NET wxProtocolLog
21 {
22 public:
23 // Create object doing the logging using wxLogTrace() with the specified
24 // trace mask.
25 wxProtocolLog(const wxString& traceMask)
26 : m_traceMask(traceMask)
27 {
28 }
29
30 // Virtual dtor for the base class
31 virtual ~wxProtocolLog() { }
32
33 // Called by wxProtocol-derived classes to actually log something
34 virtual void LogRequest(const wxString& str)
35 {
36 DoLogString("==> " + str);
37 }
38
39 virtual void LogResponse(const wxString& str)
40 {
41 DoLogString("<== " + str);
42 }
43
44 protected:
45 // Can be overridden by the derived classes.
46 virtual void DoLogString(const wxString& str);
47
48 private:
49 const wxString m_traceMask;
50
51 wxDECLARE_NO_COPY_CLASS(wxProtocolLog);
52 };
53
54 #endif // _WX_PROTOCOL_LOG_H_
55