2323"""
2424
2525import json
26+ import logging
2627
2728from tornado .web import RequestHandler
2829
30+ _logger = logging .getLogger (__name__ )
31+
2932from . import from_json , from_yaml , get_contributions , list_project_commits , store_contributions , to_json , to_yaml
3033from .models import ProjectContributions
3134from .store import (
@@ -147,6 +150,7 @@ def get(self):
147150 self .write (json .dumps ({"error" : str (e )}))
148151 return
149152 except Exception as e :
153+ _logger .exception ("GET /contributions/get doi=%s" , doi )
150154 self .set_status (500 )
151155 self .write (json .dumps ({"error" : str (e )}))
152156 return
@@ -176,6 +180,7 @@ def get(self):
176180 self .write (json .dumps ({"error" : str (e )}))
177181 return
178182 except Exception as e :
183+ _logger .exception ("GET /contributions/get history project=%s" , project )
179184 self .set_status (500 )
180185 self .write (json .dumps ({"error" : str (e )}))
181186 return
@@ -193,6 +198,7 @@ def get(self):
193198 self .write (json .dumps ({"error" : str (e )}))
194199 return
195200 except Exception as e :
201+ _logger .exception ("GET /contributions/get project=%s commit=%s" , project , commit )
196202 self .set_status (500 )
197203 self .write (json .dumps ({"error" : str (e )}))
198204 return
@@ -278,6 +284,7 @@ def post(self):
278284 try :
279285 commit_hash = store_contributions (project , new_contributions , message = message )
280286 except Exception as e :
287+ _logger .exception ("POST /contributions/post project=%s" , project )
281288 self .set_status (500 )
282289 self .write (json .dumps ({"error" : str (e )}))
283290 return
@@ -349,6 +356,7 @@ def get(self):
349356 self .write (json .dumps ({"error" : str (e )}))
350357 return
351358 except Exception as e :
359+ _logger .exception ("GET /contributions/token doi=%s" , doi )
352360 self .set_status (500 )
353361 self .write (json .dumps ({"error" : str (e )}))
354362 return
@@ -362,6 +370,7 @@ def get(self):
362370 try :
363371 token_id = create_token (project_name , token_type , author_name = author , expires_days = days )
364372 except Exception as e :
373+ _logger .exception ("GET /contributions/token create_token project=%s type=%s" , project_name , token_type )
365374 self .set_status (500 )
366375 self .write (json .dumps ({"error" : str (e )}))
367376 return
0 commit comments