Move log function into common