refactor Logging into smaller pieces