Making debug logging conditional