Adds logging function.