added scan-logging to file function