create pretty-print string outside of handler