##// END OF EJS Templates
added extra logging into API calls
marcink -
r2656:c785ad55 beta
parent child Browse files
Show More
@@ -30,6 +30,7 b' import logging'
30 import types
30 import types
31 import urllib
31 import urllib
32 import traceback
32 import traceback
33 import time
33
34
34 from rhodecode.lib.compat import izip_longest, json
35 from rhodecode.lib.compat import izip_longest, json
35
36
@@ -43,6 +44,8 b' HTTPBadRequest, HTTPError'
43
44
44 from rhodecode.model.db import User
45 from rhodecode.model.db import User
45 from rhodecode.lib.auth import AuthUser
46 from rhodecode.lib.auth import AuthUser
47 from rhodecode.lib.base import _get_ip_addr, _get_access_path
48 from rhodecode.lib.utils2 import safe_unicode
46
49
47 log = logging.getLogger('JSONRPC')
50 log = logging.getLogger('JSONRPC')
48
51
@@ -95,6 +98,7 b' class JSONRPCController(WSGIController):'
95 Parse the request body as JSON, look up the method on the
98 Parse the request body as JSON, look up the method on the
96 controller and if it exists, dispatch to it.
99 controller and if it exists, dispatch to it.
97 """
100 """
101 start = time.time()
98 self._req_id = None
102 self._req_id = None
99 if 'CONTENT_LENGTH' not in environ:
103 if 'CONTENT_LENGTH' not in environ:
100 log.debug("No Content-Length")
104 log.debug("No Content-Length")
@@ -218,7 +222,10 b' class JSONRPCController(WSGIController):'
218 headers.append(('Content-Length', str(len(output[0]))))
222 headers.append(('Content-Length', str(len(output[0]))))
219 replace_header(headers, 'Content-Type', 'application/json')
223 replace_header(headers, 'Content-Type', 'application/json')
220 start_response(status[0], headers, exc_info[0])
224 start_response(status[0], headers, exc_info[0])
221
225 log.info('IP: %s Request to %s time: %.3fs' % (
226 _get_ip_addr(environ),
227 safe_unicode(_get_access_path(environ)), time.time() - start)
228 )
222 return output
229 return output
223
230
224 def _dispatch_call(self):
231 def _dispatch_call(self):
General Comments 0
You need to be logged in to leave comments. Login now