mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04: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
@ -177,6 +177,15 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
|
|||||||
inspect.stack()[1][3]), end='')
|
inspect.stack()[1][3]), end='')
|
||||||
for a in args:
|
for a in args:
|
||||||
try:
|
try:
|
||||||
|
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='')
|
prints('', a, end='')
|
||||||
except:
|
except:
|
||||||
prints('', 'value too long', end='')
|
prints('', 'value too long', end='')
|
||||||
@ -587,6 +596,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
|
|||||||
self._debug('Protocol error - bogus book packet length')
|
self._debug('Protocol error - bogus book packet length')
|
||||||
self._close_device_socket()
|
self._close_device_socket()
|
||||||
return False
|
return False
|
||||||
|
self._debug('CC version #:', result.get('ccVersionNumber', 'unknown'))
|
||||||
self.max_book_packet_len = result.get('maxBookContentPacketLen',
|
self.max_book_packet_len = result.get('maxBookContentPacketLen',
|
||||||
self.BASE_PACKET_LEN)
|
self.BASE_PACKET_LEN)
|
||||||
exts = result.get('acceptedExtensions', None)
|
exts = result.get('acceptedExtensions', None)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user