Add -o option which logs statistics in CSV format

Initial support for logging in CSV format.

resolves #4