Use printf instead of util.format

use beautify on json output only if prettyprint
output an indicator that meta data was hidden
Please remove the superfluous space before `msg`.