use debug instead of logger when debug