From 025e6222ffb638b087e6dc10d3dd18aab14df6e1 Mon Sep 17 00:00:00 2001 From: jnk Date: Sat, 4 May 2019 11:17:13 +0200 Subject: [PATCH 1/2] logger added to adapter.py --- requests_mock/adapter.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/requests_mock/adapter.py b/requests_mock/adapter.py index a642b78..d8bec74 100644 --- a/requests_mock/adapter.py +++ b/requests_mock/adapter.py @@ -20,6 +20,10 @@ from requests_mock.request import _RequestObjectProxy from requests_mock.response import _MatcherResponse +import logging + +logger = logging.getLogger(__name__) + try: import purl purl_types = (purl.URL,) @@ -245,6 +249,7 @@ def send(self, request, **kwargs): if resp is not None: request._matcher = weakref.ref(matcher) resp.connection = self + logger.debug('{} \"{} \" {}'.format(request._request.url,request._request.method, resp.status_code)) return resp raise exceptions.NoMockAddress(request) From 8a3026e0a9011e456649b6c28d5a231f56969f3a Mon Sep 17 00:00:00 2001 From: jnk Date: Tue, 21 May 2019 21:36:38 +0200 Subject: [PATCH 2/2] change request logging format --- requests_mock/adapter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requests_mock/adapter.py b/requests_mock/adapter.py index d8bec74..6bb6527 100644 --- a/requests_mock/adapter.py +++ b/requests_mock/adapter.py @@ -249,7 +249,7 @@ def send(self, request, **kwargs): if resp is not None: request._matcher = weakref.ref(matcher) resp.connection = self - logger.debug('{} \"{} \" {}'.format(request._request.url,request._request.method, resp.status_code)) + logger.debug('{} {} {}'.format(request._request.method,request._request.url, resp.status_code)) return resp raise exceptions.NoMockAddress(request)