HomePhabricator

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

Description

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