logfile method for python scripts