Changed WriteInFile to use log package instead of os package