code: def set_logger(args):
      """Write logs to console and log file."""
      log_file = os.path.join(args.save_path, "train.log")
      logging.basicConfig(
          format="%(asctime)s %(levelname)-8s %(message)s",
          level=logging.INFO,
          datefmt="%Y-%m-%d %H:%M:%S",
          filename=log_file,
          filemode="a+",
      )
      if args.print_on_screen:
          console = logging.StreamHandler()
          console.setLevel(logging.INFO)
          formatter = logging.Formatter(
              "%(asctime)s %(levelname)-8s %(message)s"
          )
          console.setFormatter(formatter)
          logging.getLogger("").addHandler(console)
  
      for arg in vars(args):
          logging.info("{:20}:{}".format(arg, getattr(args, arg)))
  
imports: import os
  import csv
  import math
  import json
  import time
  import random
  import logging
  import functools
  import traceback
  from collections import defaultdict
  from _thread import start_new_thread
  from multiprocessing import Queue, Process
  import numpy
  from tqdm import tqdm
  import paddle
  import paddle.distributed
label_desc: Use image node_id 2 for calling a global function with example usage: set_logger(args) without return types