X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/730b772b41ad9df76e5226290bb9eb917ea161f0..8f4745feeb2850f3bebb3af45407e164550d541a:/src/common/protocol.cpp diff --git a/src/common/protocol.cpp b/src/common/protocol.cpp index 4a06cf857b..1f508709eb 100644 --- a/src/common/protocol.cpp +++ b/src/common/protocol.cpp @@ -19,12 +19,14 @@ #if wxUSE_PROTOCOL #include "wx/protocol/protocol.h" +#include "wx/protocol/log.h" #ifndef WX_PRECOMP #include "wx/module.h" #endif #include "wx/url.h" +#include "wx/log.h" #include @@ -64,6 +66,7 @@ wxProtocol::wxProtocol() #endif { m_lastError = wxPROTO_NOERR; + m_log = NULL; SetDefaultTimeout(60); // default timeout is 60 seconds } @@ -95,6 +98,10 @@ void wxProtocol::SetDefaultTimeout(wxUint32 Value) #endif } +wxProtocol::~wxProtocol() +{ + delete m_log; +} // ---------------------------------------------------------------------------- // Read a line from socket @@ -179,4 +186,32 @@ wxProtocolError wxProtocol::ReadLine(wxString& result) #endif // wxUSE_SOCKETS +// ---------------------------------------------------------------------------- +// logging +// ---------------------------------------------------------------------------- + +void wxProtocol::SetLog(wxProtocolLog *log) +{ + delete m_log; + m_log = log; +} + +void wxProtocol::LogRequest(const wxString& str) +{ + if ( m_log ) + m_log->LogRequest(str); +} + +void wxProtocol::LogResponse(const wxString& str) +{ + if ( m_log ) + m_log->LogResponse(str); +} + +void wxProtocolLog::DoLogString(const wxString& str) +{ + wxUnusedVar(str); // unused if wxLogTrace() is disabled + wxLogTrace(m_traceMask, "%s", str); +} + #endif // wxUSE_PROTOCOL