Improved logger logic.