Move log macros to log module and refactor if. Fix comments.