Output debugging info to log only if debugging is turned on