move loging code into logger module