add the logging function