Shifted logging init into a function