some logs added to write to file function