Refactored and improved logger setup.