utils: Move logging-related code into separate file