Improved logging using different levels and better formatting.