4.0: re-add and improve check_log function