Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 068a64a

Browse files
author
Jon Wayne Parrott
committed
Adding logging to endpoints sample
Change-Id: I50cf76a7bb51c6dc36785d47ea4d175382dea93f
1 parent 3ecda8b commit 068a64a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

managed_vms/endpoints/main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import base64
2222
import json
23+
import logging
2324

2425
from flask import Flask, jsonify, request, send_from_directory
2526
from six.moves import http_client
@@ -78,6 +79,7 @@ def auth_info_google_id_token():
7879
@app.errorhandler(http_client.INTERNAL_SERVER_ERROR)
7980
def unexpected_error(e):
8081
"""Handle exceptions by returning swagger-compliant json."""
82+
logging.exception('An error occured while processing the request.')
8183
response = jsonify({
8284
'code': http_client.INTERNAL_SERVER_ERROR,
8385
'message': 'Exception: {}'.format(e)})

0 commit comments

Comments
 (0)