Added support for CSV output

Fixed. I also added an assertion to verify the log output.