Adds compact output method.

Fixs #14470.