Add conditional debug logging