misc: add logging of payloads
gitea/gitea-redmine/pipeline/head This commit looks good Details

This commit is contained in:
Benjamin Dauvergne 2023-04-14 14:36:19 +02:00
parent 6cd1c60281
commit cc56fcf034
1 changed files with 2 additions and 2 deletions

View File

@ -1,4 +1,3 @@
import functools
import json
import logging
import os
@ -46,6 +45,7 @@ def incoming_webhook(token):
return {'status': 'error', 'detail': 'Invalid token'}, 403
payload = flask.request.json
logging.info('Received payload %s', json.dumps(payload, indent=2))
handler, event = get_handler(payload)
if not handler:
logging.info('Skipping, no handler found for this webhook')
@ -72,7 +72,7 @@ def incoming_webhook(token):
project = get_redmine_project(issue.project.id)
logging.info(f'Calling handler {event} for issue {issue.id}')
handler(issue, payload, project)
logging.info(f' Done')
logging.info('Done')
return {'status': 'success', 'detail': 'Event processed and forwarded to redmine'}