import logging
# 有什么用
logger = logging.getLogger(__name__)
logging.basicConfig(
format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
datefmt="%m/%d/%Y %H:%M:%S",
handlers=[logging.StreamHandler(sys.stdout)],
)
logger.setLevel(logging.INFO)
logger.info("Options")
logger.setLevel(logging.INFO if is_main_process(training_args.local_rank) else logging.WARN)
日志输出格式
06/20/2023 13:28:37 - INFO - __main__ - Options