Logfile function combined

Commented the old one