From ec0413b8c1e97bcc8a39e6b197ba2a0ee1b039ea Mon Sep 17 00:00:00 2001 From: Christoph Burgdorf Date: Mon, 25 Feb 2019 15:24:23 +0100 Subject: [PATCH] Update to Lahja version that fixes logging --- setup.py | 2 +- trinity/bootstrap.py | 2 +- trinity/endpoint.py | 12 +++++------- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/setup.py b/setup.py index fd37523d2f..ccf5fc3808 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ "plyvel==1.0.5", "py-evm==0.2.0a40", "web3==4.4.1", - "lahja==0.11.1", + "lahja==0.11.2", "termcolor>=1.1.0,<2.0.0", "uvloop==0.11.2;platform_system=='Linux' or platform_system=='Darwin' or platform_system=='FreeBSD'", "websockets==5.0.1", diff --git a/trinity/bootstrap.py b/trinity/bootstrap.py index 3b4c68fb2d..ee73e44b3a 100644 --- a/trinity/bootstrap.py +++ b/trinity/bootstrap.py @@ -142,7 +142,7 @@ def main_entry(trinity_boot: BootFn, if args.log_levels: setup_log_levels(args.log_levels) - main_endpoint.track_and_propagate_available_endpoints(stderr_logger) + main_endpoint.track_and_propagate_available_endpoints() try: trinity_config = TrinityConfig.from_parser_args(args, app_identifier, sub_configs) except AmbigiousFileSystem: diff --git a/trinity/endpoint.py b/trinity/endpoint.py index 5bad3df90d..2e4298b584 100644 --- a/trinity/endpoint.py +++ b/trinity/endpoint.py @@ -1,4 +1,3 @@ -import logging from typing import ( Tuple, ) @@ -41,7 +40,7 @@ def connect_to_other_endpoints(self, elif self.is_connected_to(connection_config.name): continue else: - self._logger.info( + self.logger.info( "EventBus Endpoint %s connecting to other Endpoint %s", self.name, connection_config.name @@ -73,11 +72,10 @@ class TrinityMainEventBusEndpoint(TrinityEventBusEndpoint): available_endpoints: Tuple[ConnectionConfig, ...] - def track_and_propagate_available_endpoints(self, logger: logging.Logger) -> None: + def track_and_propagate_available_endpoints(self) -> None: """ Track new announced endpoints and propagate them across all other existing endpoints. """ - self.available_endpoints = tuple() def handle_new_endpoints(ev: EventBusConnected) -> None: @@ -87,16 +85,16 @@ def handle_new_endpoints(ev: EventBusConnected) -> None: # event multiple times which would then raise an exception if we are already connected # to that endpoint. if not self.is_connected_to(ev.connection_config.name): - logger.info( + self.logger.info( "EventBus of main process connecting to EventBus %s", ev.connection_config.name ) self.connect_to_endpoints_blocking(ev.connection_config) self.available_endpoints = self.available_endpoints + (ev.connection_config,) - logger.debug("New EventBus Endpoint connected %s", ev.connection_config.name) + self.logger.debug("New EventBus Endpoint connected %s", ev.connection_config.name) # Broadcast available endpoints to all connected endpoints, giving them # a chance to cross connect self.broadcast(AvailableEndpointsUpdated(self.available_endpoints)) - logger.debug("Connected EventBus Endpoints %s", self.available_endpoints) + self.logger.debug("Connected EventBus Endpoints %s", self.available_endpoints) self.subscribe(EventBusConnected, handle_new_endpoints)