Improve the performance of phutil_loggable_string()

Summary:
Ref T4162.

  - Before doing anything character oriented, test if the whole string is fine to print as-is.
  - Reduce the number of calls to `string()`.

Test Plan: Saw cost drop on profiles.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T4162

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