#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 <stdlib.h>
#endif
{
m_lastError = wxPROTO_NOERR;
+ m_log = NULL;
SetDefaultTimeout(60); // default timeout is 60 seconds
}
#endif
}
+wxProtocol::~wxProtocol()
+{
+ delete m_log;
+}
// ----------------------------------------------------------------------------
// Read a line from socket
#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