Optimize log verbosity checks in some performance sensitive parts.