mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 20:24:49 +02:00
SmartDevice: better handling of very long strings (e.g., book data) in debug logs. Log the CC version build number if the client reports it.
This commit is contained in:
parent
b3e5d18975
commit
39559867ae
1 changed files with 11 additions and 1 deletions
|
|
@ -177,7 +177,16 @@ def _debug(self, *args):
|
|||
inspect.stack()[1][3]), end='')
|
||||
for a in args:
|
||||
try:
|
||||
prints('', a, end='')
|
||||
if isinstance(a, dict):
|
||||
printable = {}
|
||||
for k,v in a.iteritems():
|
||||
if isinstance(v, (str, unicode)) and len(v) > 50:
|
||||
printable[k] = 'too long'
|
||||
else:
|
||||
printable[k] = v
|
||||
prints('', printable, end='');
|
||||
else:
|
||||
prints('', a, end='')
|
||||
except:
|
||||
prints('', 'value too long', end='')
|
||||
print()
|
||||
|
|
@ -587,6 +596,7 @@ def open(self, connected_device, library_uuid):
|
|||
self._debug('Protocol error - bogus book packet length')
|
||||
self._close_device_socket()
|
||||
return False
|
||||
self._debug('CC version #:', result.get('ccVersionNumber', 'unknown'))
|
||||
self.max_book_packet_len = result.get('maxBookContentPacketLen',
|
||||
self.BASE_PACKET_LEN)
|
||||
exts = result.get('acceptedExtensions', None)
|
||||
|
|
|
|||
Loading…
Reference in a new issue