Refactored logfile output into a function.