diff --git a/trezorlib/transport/bridge.py b/trezorlib/transport/bridge.py index cb38ec64f..898e6a62c 100644 --- a/trezorlib/transport/bridge.py +++ b/trezorlib/transport/bridge.py @@ -17,6 +17,7 @@ # You should have received a copy of the GNU Lesser General Public License # along with this library. If not, see . +import logging import requests import binascii from io import BytesIO @@ -27,6 +28,8 @@ from .. import messages from .. import protobuf from . import Transport, TransportException +LOG = logging.getLogger(__name__) + TREZORD_HOST = 'http://127.0.0.1:21325' @@ -78,6 +81,8 @@ class BridgeTransport(Transport): self.session = None def write(self, msg): + LOG.debug("sending message: {}".format(msg.__class__.__name__), + extra={'protobuf': msg}) data = BytesIO() protobuf.dump_message(data, msg) ser = data.getvalue() @@ -97,5 +102,7 @@ class BridgeTransport(Transport): (msg_type, datalen) = struct.unpack('>HL', data[:headerlen]) data = BytesIO(data[headerlen:headerlen + datalen]) msg = protobuf.load_message(data, mapping.get_class(msg_type)) + LOG.debug("received message: {}".format(msg.__class__.__name__), + extra={'protobuf': msg}) self.response = None return msg