Refactored log check