Improve "--trace" behavior when output includes binary queries
Improve "--trace" behavior when output includes binary queries

Summary:
Ref T13164. See PHI766. If you `bin/harbormaster rebuild-log ... --force --trace`, you can get a trace with a bunch of binary gzip data in it.

This tends to make your terminal beep a lot and sometimes turn into funny colors or symbols.

Instead, replace runs of binary data with the text "<...binary data...>". Also, collapse multiple consecutive whitespace characters into a single whitespace character.

Broadly, both changes make these traces easier to read.

Test Plan: Ran `bin/harbormaster rebuild-log ... --force --trace` on a 20MB log of reasonably normal data, no longer got beeped at fifty times.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13164

Differential Revision: https://secure.phabricator.com/D19564

Khan/libphutil,uber/libphutil,wikimedia/phabricator-libphutil,wikimedia/phabricator-libphutil,aik099/libphutil,codelabs-ch/libphutil,uber/libphutil,uhd-urz/libphutil,aik099/libphutil,devurandom/libphutil,devurandom/libphutil,aik099/libphutil,devurandom/libphutil,codelabs-ch/libphutil,Khan/libphutil,uhd-urz/libphutil,codelabs-ch/libphutil,Khan/libphutil,wikimedia/phabricator-libphutil,uhd-urz/libphutil,uber/libphutil