Add feature: write log to file instead of stdout