Fixes logging based on debug value.