Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
log what we return instead of Response.get_data()
Browse files Browse the repository at this point in the history
The Response.get_data() function wasn't giving us the whole data, but a
list of keys in the data like so:

now

    DEBUG [ptero_workflow.api.v1.views]     Returning: ( { 'begins': [0],
        'color': 0,
        'colors': [0],
        'data': { u'petri_response_links': ...
        'inputs': { u'param': u'foo'},
        'method': { 'name': u'execute',
                    'service': u'shell-command',
                    'task': { 'name': u'C', 'type': u'method-list'}},
        'outputs': { u'param': u'foo'},
        'parent_color': None,
        'status': u'begun',
        'status_history': [ { 'status': u'begun',
                              'timestamp': '2015-01-28 01:07:18'}]},
      200)

was

    DEBUG [ptero_workflow.api.v1.views]     Body: 'beginscolorcolorsdatainputsmethodoutputsparent_colorstatusstatus_history'

which is not helpful.
  • Loading branch information
davidlmorton committed Jan 28, 2015
1 parent 78d2104 commit 6c0693c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ptero_common/logging_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from requests.models import Request
import logging
import os
from pprint import pformat

try:
from flask import request
Expand Down Expand Up @@ -64,8 +65,8 @@ def wrapper(*args, **kwargs):
response = Response(*result)
logger.info("Responded %s to %s %s",
response.status_code, target.__name__.upper(), request.url)
logger.debug(" Headers: '%s'", response.headers)
logger.debug(" Body: '%s'", response.get_data())
logger.debug(" Returning: %s",
pformat(result, indent=2, width=80))
return result
return wrapper
return _log_response
Expand Down

0 comments on commit 6c0693c

Please sign in to comment.