#1: First version of log to file feature.
Refactored some logic. Use async appendFile