Adding the logging function