Completed scanLog function