Add support for logging to stdout or a file