The problem with #3072 is that it modifies every output line with an if (csv) to get csv output. This is tedious and error-prone. A better approach would be to have a new formatted printf() that extracts the format statements and outputs in CSV format if a format is set, otherwise uses the full format information.