0003-utils-only-log-requests-response-as-info-31114.patch
passerelle/utils/__init__.py | ||
---|---|---|
262 | 262 |
extra['request_headers'] = dict(request.headers.items()) |
263 | 263 |
if request.body: |
264 | 264 |
extra['request_payload'] = repr(request.body[:5000]) |
265 |
log_function = self.logger.info |
|
266 | 265 |
if response is not None: |
267 | 266 |
message = message + ' (=> %s)' % response.status_code |
268 | 267 |
extra['response_status'] = response.status_code |
... | ... | |
271 | 270 |
# log body only if content type is allowed |
272 | 271 |
if content_type_match(response.headers.get('Content-Type')): |
273 | 272 |
content = response.content[:settings.LOGGED_RESPONSES_MAX_SIZE] |
274 |
extra['response_content'] = repr(content) |
|
275 |
if response.status_code // 100 == 3: |
|
276 |
log_function = self.logger.warning |
|
277 |
elif response.status_code // 100 >= 4: |
|
278 |
log_function = self.logger.error |
|
273 |
extra['response_content'] = repr(content[:5000]) |
|
279 | 274 |
elif exception: |
280 | 275 |
message = message + ' (=> %s)' % repr(exception) |
281 | 276 |
extra['response_exception'] = repr(exception) |
282 |
log_function = self.logger.error |
|
283 | ||
284 |
log_function(message, extra=extra) |
|
277 |
self.logger.info(message, extra=extra) |
|
285 | 278 | |
286 | 279 | |
287 | 280 |
class SOAPClient(Client): |
288 |
- |