Skip to content
Snippets Groups Projects
Commit c1b8afe5 authored by Mitchell Moore's avatar Mitchell Moore
Browse files

add timestamps to server logs

parent cee61287
No related branches found
No related tags found
No related merge requests found
...@@ -40,12 +40,12 @@ def check_dir(user, interval): ...@@ -40,12 +40,12 @@ def check_dir(user, interval):
@socketio.on('user connect') @socketio.on('user connect')
def handle_my_custom_event(json, methods=['GET', 'POST']): def handle_my_custom_event(json, methods=['GET', 'POST']):
username = json["user"] username = json["user"]
print('User ' + username + ' connected.') print(time.strftime("%m-%d-%Y_%H:%M:%S") + '\tUser ' + username + ' connected.')
@socketio.on('user data') @socketio.on('user data')
def ingest_data(json, methods=['GET', 'POST']): def ingest_data(json, methods=['GET', 'POST']):
print ('Queue request received: ', str(json)) print (time.strftime("%m-%d-%Y_%H:%M:%S") + '\tQueue request received: ' + str(json))
try: try:
fullname = json["fullname"] fullname = json["fullname"]
...@@ -65,11 +65,11 @@ def ingest_data(json, methods=['GET', 'POST']): ...@@ -65,11 +65,11 @@ def ingest_data(json, methods=['GET', 'POST']):
file.write(reason) file.write(reason)
file.close() file.close()
print ('User ' + username + ' added to queue') print (time.strftime("%m-%d-%Y_%H:%M:%S") + '\tUser ' + username + ' added to queue')
socketio.emit("creating account") socketio.emit("creating account")
except Exception as e: except Exception as e:
print("Error in directory creation: ", e) print(time.strftime("%m-%d-%Y_%H:%M:%S") + "\tError in directory creation: ", e)
socketio.emit("Account creation failed") socketio.emit("Account creation failed")
...@@ -78,7 +78,7 @@ def creation_confirmation(json, methods=['GET', 'POST']): ...@@ -78,7 +78,7 @@ def creation_confirmation(json, methods=['GET', 'POST']):
username = json["username"] username = json["username"]
if check_dir(username, 10): if check_dir(username, 10):
print ('Account successfully created for ' + username) print (time.strftime("%m-%d-%Y_%H:%M:%S") + '\tAccount successfully created for ' + username)
socketio.emit("Account created") socketio.emit("Account created")
else: else:
socketio.emit("Account creation failed") socketio.emit("Account creation failed")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment