Nicer logging configuration.

How the timestamp is logged, and the requests handled by werkzeug too.
This commit is contained in:
Sybren A. Stüvel 2016-03-15 10:29:59 +01:00
parent 43453ff666
commit ab8b32af7f
2 changed files with 9 additions and 3 deletions

View File

@ -94,7 +94,12 @@ import config
app.config.from_object(config.Deployment)
# Configure logging
logging.basicConfig(level=logging.WARNING)
logging.basicConfig(
level=logging.WARNING,
format='%(asctime)-15s %(levelname)8s %(name)s %(message)s')
logging.getLogger('werkzeug').setLevel(logging.INFO)
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG if app.config['DEBUG'] else logging.INFO)
log.info('Pillar starting')

View File

@ -39,8 +39,9 @@ def validate(token):
payload = dict(
token=token)
try:
r = requests.post("{0}/u/validate_token".format(
SystemUtility.blender_id_endpoint()), data=payload)
url = "{0}/u/validate_token".format(SystemUtility.blender_id_endpoint())
log.debug('POSTing to %r', url)
r = requests.post(url, data=payload)
except requests.exceptions.ConnectionError as e:
raise e