1 /* 2 * Copyright 2017-2021, Andrew Lindesay <apl@lindesay.co.nz>. 3 * All rights reserved. Distributed under the terms of the MIT License. 4 */ 5 6 #include <UrlProtocolListener.h> 7 #include <UrlRequest.h> 8 9 using BPrivate::Network::BUrlProtocolDebugMessage; 10 using BPrivate::Network::BUrlProtocolListener; 11 using BPrivate::Network::BUrlRequest; 12 13 14 class LoggingUrlProtocolListener : public BUrlProtocolListener { 15 public: 16 LoggingUrlProtocolListener( 17 BString traceLoggingIdentifier, 18 bool traceLogging); 19 virtual ~LoggingUrlProtocolListener(); 20 21 size_t ContentLength(); 22 23 void BytesWritten(BUrlRequest* caller, 24 size_t bytesWritten); 25 void DebugMessage(BUrlRequest* caller, 26 BUrlProtocolDebugMessage type, 27 const char* text); 28 29 private: 30 bool fTraceLogging; 31 BString fTraceLoggingIdentifier; 32 size_t fContentLength; 33 34 35 }; 36