refactor log module.