Updated logging function.