Fix debug logs to happen only when debugging