Clean up logging -- extract uglyness to a module