Added logging function to the script