1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/protocol/log.h
3 // Purpose: wxProtocolLog class for logging network exchanges
4 // Author: Troelsk, Vadim Zeitlin
7 // Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_PROTOCOL_LOG_H_
12 #define _WX_PROTOCOL_LOG_H_
14 #include "wx/string.h"
16 // ----------------------------------------------------------------------------
17 // wxProtocolLog: simple class for logging network requests and responses
18 // ----------------------------------------------------------------------------
20 class WXDLLIMPEXP_NET wxProtocolLog
23 // Create object doing the logging using wxLogTrace() with the specified
25 wxProtocolLog(const wxString
& traceMask
)
26 : m_traceMask(traceMask
)
30 // Virtual dtor for the base class
31 virtual ~wxProtocolLog() { }
33 // Called by wxProtocol-derived classes to actually log something
34 virtual void LogRequest(const wxString
& str
)
36 DoLogString("==> " + str
);
39 virtual void LogResponse(const wxString
& str
)
41 DoLogString("<== " + str
);
45 // Can be overridden by the derived classes.
46 virtual void DoLogString(const wxString
& str
);
49 const wxString m_traceMask
;
51 wxDECLARE_NO_COPY_CLASS(wxProtocolLog
);
54 #endif // _WX_PROTOCOL_LOG_H_