move log out of common and add some utils