Refactorer logging into single method.