Skip to content

Commit

Permalink
Adding logging for Beta release
Browse files Browse the repository at this point in the history
  • Loading branch information
zhanghan177 committed Mar 30, 2017
1 parent b286895 commit 9ede76f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion web/api/relay_agent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

app = Flask(__name__)
cors = CORS(app, resources={r"/api/*": {"origins": "*"}})
socketio = SocketIO(app)
socketio = SocketIO(app, engineio_logger=True)

api_prefix = '/api'
socket_prefix = api_prefix + '/socket'
Expand Down
6 changes: 5 additions & 1 deletion web/api/relay_agent/blueprints/chat_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def get_history(stream_id):
@apiDescription This endpoint fetches all chat history for a specific stream
"""
logging.info('Receive request for /chat/' + stream_id)
viewer = request.args.get('viewer_only', '')
if viewer == 'true':
viewer = True
Expand All @@ -52,4 +53,7 @@ def get_history(stream_id):
messages = [{'chat_id': i[0], 'chat_content': i[1], 'chat_created_at': mktime(i[2].timetuple())}
for i in results]

return jsonify({'success': True, 'chat_messages': messages})
response = {'success': True, 'chat_messages': messages}
logging.info('Response for /chat/' + stream_id + ': ' + str(response))

return jsonify(response)
4 changes: 4 additions & 0 deletions web/api/relay_agent/blueprints/stream_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ def query_by_ip(ip_addr):
@apiDescription This endpoint takes an IP as a query parameter. It looks up in the database
about associated active stream. Returns the stream ID.
"""
logging.info('Receive request for /stream/query/' + ip_addr)
conn, cur = get_cursor()

stmt = "SELECT id FROM streams WHERE streamer_ip = %s;"
Expand All @@ -159,6 +160,9 @@ def query_by_ip(ip_addr):
response = {'success': False}

fin(conn, cur)

logging.info('Response for /stream/query/' + ip_addr + ': ' + str(response))

return jsonify(response)


Expand Down

0 comments on commit 9ede76f

Please sign in to comment.