simplify logging and fix a potential bug if configure_logging(True) is run multiple times