Browse Source

convert prints to logger.infos

master
rozetko 4 years ago
parent
commit
59dac556eb
  1. 3
      analytics/server.py
  2. 2
      analytics/services/server_service.py

3
analytics/server.py

@ -18,6 +18,7 @@ server_service: services.ServerService = None
data_service: services.DataService = None data_service: services.DataService = None
analytic_unit_manager: AnalyticUnitManager = None analytic_unit_manager: AnalyticUnitManager = None
logging.root.setLevel(config.LOGGING_LEVEL)
logger = logging.getLogger('SERVER') logger = logging.getLogger('SERVER')
@ -88,7 +89,7 @@ def run_server():
#loop.set_debug(True) #loop.set_debug(True)
logger.info("Ok") logger.info("Ok")
init_services() init_services()
print('Analytics process is running') # we need to print to stdout and flush logger.info('Analytics process is running') # we need to print to stdout and flush
sys.stdout.flush() # because node.js expects it sys.stdout.flush() # because node.js expects it
loop.run_until_complete(app_loop()) loop.run_until_complete(app_loop())

2
analytics/services/server_service.py

@ -111,7 +111,7 @@ class ServerService(utils.concurrent.AsyncZmqActor):
self.__server_socket = None self.__server_socket = None
# TODO: move to config # TODO: move to config
reconnect_delay = 3 reconnect_delay = 3
print('connection is refused or lost, trying to reconnect in %s seconds' % reconnect_delay) logger.info('connection is refused or lost, trying to reconnect in %s seconds' % reconnect_delay)
await asyncio.sleep(reconnect_delay) await asyncio.sleep(reconnect_delay)
raise InterruptedError() raise InterruptedError()

Loading…
Cancel
Save