code: def get_logger(output_dir=None):
      if output_dir != None:
          os.makedirs(output_dir, exist_ok=True)
          logging.basicConfig(
              format="%(asctime)s - %(levelname)s - %(name)s -   %(message)s",
              datefmt="%m/%d/%Y %H:%M:%S",
              level=logging.INFO,
              handlers=[
                  logging.FileHandler(
                      "{}/log.txt".format(output_dir),
                      mode="a",
                      delay=False,
                  ),
                  logging.StreamHandler(sys.stdout),
              ],
          )
      else:
          logging.basicConfig(
              format="%(asctime)s - %(levelname)s - %(name)s -   %(message)s",
              datefmt="%m/%d/%Y %H:%M:%S",
              level=logging.INFO,
              handlers=[logging.StreamHandler(sys.stdout)],
          )
  
      logger = logging.getLogger("Blink")
      logger.setLevel(10)
      return logger
  
imports: import os
  import io
  import sys
  import json
  import torch
  import logging
  import numpy
  from collections import OrderedDict
  from pytorch_transformers.modeling_utils import CONFIG_NAME, WEIGHTS_NAME
  from tqdm import tqdm
  from blink.candidate_ranking.bert_reranking import BertReranker
  from blink.biencoder.biencoder import BiEncoderRanker
label_desc: Use image node_id 8 for calling a global function with example usage: get_logger(output_dir) and returns: logger