log only when logging is enabled