From 6548254fe1ab04e6c4f8400abb5e2beab6384539 Mon Sep 17 00:00:00 2001 From: Tasio Mendez Date: Mon, 16 Apr 2018 11:17:15 +0200 Subject: [PATCH] Logs fixed --- server.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/server.py b/server.py index 1a0840f..e6d2695 100644 --- a/server.py +++ b/server.py @@ -89,7 +89,7 @@ class SocketHandler(tornado.websocket.WebSocketHandler): elif msg['type'] == 'get_trial': if self.application.verbose: logger.info('Trial {} requested!'.format(msg['data'])) - self.send_log('INFO.user', 'Trial {} requested!'.format(msg['data'])) + self.send_log('INFO.' + __name__, 'Trial {} requested!'.format(msg['data'])) self.write_message({'type': 'get_trial', 'data': self.get_trial( int(msg['data']) ) }) @@ -154,16 +154,16 @@ class SocketHandler(tornado.websocket.WebSocketHandler): with self.logging(self.application.simulator.name): try: self.simulation = self.application.simulator.run(self.config) + trials = [] + for i in range(self.config['num_trials']): + trials.append('{}_trial_{}'.format(self.name, i)) + self.write_message({'type': 'trials', + 'data': trials }) except: error = 'Something went wrong. Please, try again.' self.write_message({'type': 'error', 'error': error}) - - trials = [] - for i in range(self.config['num_trials']): - trials.append('{}_trial_{}'.format(self.name, i)) - self.write_message({'type': 'trials', - 'data': trials }) + self.send_log('ERROR.' + self.application.simulator.name, error) def get_trial(self, trial): G = self.simulation[trial].history_to_graph()