appscript
appscript copied to clipboard
objc: Added a way to truncate descriptions of long data descriptors.
- Added one method,
+[AEMObjectRenderer setDataDescriptionTruncation:]. When set tomaxBytes, this affects the description of any descriptor that describes as hex bytes, so that only the firstmaxByteswill be displayed, followed by an ellipsis. - This is primarily useful when debugging AE interfaces that send large hunks of binary data around, such as iTunes cover art. The first few bytes of the artwork's data object are enough to tell whether you're getting a PNG or a PICT; the remaining 200K chars do nothing but make the logs harder to read and search.
- Since the data descriptor may be embedded in some other object, the
most reasonable place to put the truncation is inside its
description(or, rather, in+[formatObject:indent:result:], the recursive function that does the actual formatting underlyingdescription). - Truncation is off by default, because sometimes you do want all 200K (e.g., so you can parse the logs, unhexlify the bytes, save them as a file, and see if they're the PICT you expected).