summaryrefslogtreecommitdiff
path: root/server/handlers.py
diff options
context:
space:
mode:
Diffstat (limited to 'server/handlers.py')
-rw-r--r--server/handlers.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/server/handlers.py b/server/handlers.py
index 99b021f..0a77e66 100644
--- a/server/handlers.py
+++ b/server/handlers.py
@@ -4,6 +4,7 @@ from concurrent.futures import ThreadPoolExecutor
import traceback
from errors.session import *
import server
+import logging
class CodeqService(object):
@@ -311,15 +312,15 @@ _executor = ThreadPoolExecutor(max_workers=100)
def _invoke_handler(handler, request):
try:
- print('Worker thread processing data={}'.format(str(request.data)))
+ logging.debug('Worker thread processing data={}'.format(str(request.data)))
handler.process(request)
if not request.is_finished:
- print('ERROR: the request was not concluded!')
+ logging.error('ERROR: the request was not concluded!')
request.reply({'code': -1, 'message': 'Request processing did not provide a reply'})
- print('Processing finished')
+ logging.debug('Processing finished')
except Exception as e:
- print('ERROR: data processing failed: ' + str(e))
- traceback.print_exc()
+ logging.critical('ERROR: data processing failed: ' + str(e))
+ logging.critical(traceback.format_exc())
request.reply({'code': -1, 'message': 'Internal error: ' + str(e)})
def serve_request(json_obj):
@@ -335,7 +336,7 @@ def serve_request(json_obj):
handler = incoming_handlers.get(action)
if handler is None:
raise RequestProcessingError('No handler for ' + action)
- print("Attempting to serve action={}".format(action))
+ logging.debug("Attempting to serve action={}".format(action))
session = None
if sid is None:
if not handler.session_is_optional:
@@ -351,7 +352,7 @@ def serve_request(json_obj):
def send(tid, sid, json_obj):
# just a proxy function for now
- print('Sending reply: {}'.format(str(json_obj)))
+ logging.debug('Sending reply: {}'.format(str(json_obj)))
server.socket.sendPacket(tid, sid, json_obj)
def stop():