use debug level to control log outputs.