Split metric writing to standard out into a separate function