1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 23:48:12 +00:00

log: remove special handling of Features/CoinType in prettyprinter

now that Trezor won't send CoinTypes anymore
This commit is contained in:
matejcik 2018-05-28 15:01:17 +02:00
parent 99bc267301
commit aace6577c8
2 changed files with 3 additions and 10 deletions

View File

@ -18,7 +18,7 @@ class PrettyProtobufFormatter(logging.Formatter):
if type(record.protobuf) in OMITTED_MESSAGES:
message += " ({} bytes)".format(record.protobuf.ByteSize())
else:
message += "\n" + protobuf.format_message(record.protobuf, collapse_cointypes=True)
message += "\n" + protobuf.format_message(record.protobuf)
return message

View File

@ -352,8 +352,7 @@ def format_message(pb: MessageType,
indent: int = 0,
sep: str = ' ' * 4,
truncate_after: Optional[int] = 256,
truncate_to: Optional[int] = 64,
collapse_cointypes: bool = False) -> str:
truncate_to: Optional[int] = 64) -> str:
def mostly_printable(bytes):
if not bytes:
@ -397,14 +396,8 @@ def format_message(pb: MessageType,
return repr(value)
from .messages import Features
pb_dict = pb.__dict__.copy()
if collapse_cointypes and isinstance(pb, Features):
del pb_dict['coins']
pb_dict['coins (shortened)'] = ' '.join(coin.coin_shortcut for coin in pb.coins)
return '{name} ({size} bytes) {content}'.format(
name=pb.__class__.__name__,
size=pb.ByteSize(),
content=pformat_value(pb_dict, indent)
content=pformat_value(pb.__dict__, indent)
)