code: def get_log(log_file):
      log_folder = os.path.split(log_file)[0]
      os.makedirs(log_folder, exist_ok=True)
      logger = logging.getLogger(log_file)
      logger.setLevel(logging.DEBUG)
      fh = logging.FileHandler(log_file)
      fh.setLevel(logging.DEBUG)
      ch = logging.StreamHandler()
      ch.setLevel(logging.INFO)
      formatter = logging.Formatter(
          "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
      )
      ch.setFormatter(formatter)
      fh.setFormatter(formatter)
      logger.addHandler(ch)
      logger.addHandler(fh)
      return logger
  
file_path: graph4nlp/examples/pytorch/nmt/utils.py
imports: import logging
  import math
  import os
  import pickle
  import torch
  import torchtext.vocab
  from torch.optim.lr_scheduler import LambdaLR
  from graph4nlp.pytorch.modules.utils.vocab_utils import Vocab
label_desc: Use image node_id 2 for calling a global function with example usage: get_log(log_file) and returns: logger