code: def get_log_writers(
      opts: argparse.Namespace, save_location: Optional[str]
  ):
      is_master_node = is_master(opts)
  
      log_writers = []
      if not is_master_node:
          return log_writers
  
      tensorboard_logging = getattr(
          opts, "common.tensorboard_logging", False
      )
      if tensorboard_logging and save_location is not None:
          try:
              from torch.utils.tensorboard import SummaryWriter
          except ImportError as e:
              logger.log(
                  "Unable to import SummaryWriter from torch.utils.tensorboard. Disabling tensorboard logging"
              )
              SummaryWriter = None
  
          if SummaryWriter is not None:
              exp_dir = "{}/tb_logs".format(save_location)
              create_directories(
                  dir_path=exp_dir, is_master_node=is_master_node
              )
              log_writers.append(
                  SummaryWriter(
                      log_dir=exp_dir,
                      comment="Training and Validation logs",
                  )
              )
  
      bolt_logging = getattr(opts, "common.bolt_logging", False)
      if bolt_logging:
          try:
              from internal.utils.bolt_logger import BoltLogger
          except ModuleNotFoundError:
              BoltLogger = None
  
          if BoltLogger is None:
              logger.log(
                  "Unable to import bolt. Disabling bolt logging"
              )
          else:
              log_writers.append(BoltLogger())
  
      hub_logging = getattr(opts, "common.hub.logging", False)
      if hub_logging:
          try:
              from internal.utils.hub_logger import HubLogger
          except ModuleNotFoundError:
              HubLogger = None
  
          if HubLogger is None:
              logger.log("Unable to import hub. Disabling hub logging")
          else:
              try:
                  hub_logger = HubLogger(opts)
              except Exception as ex:
                  logger.log(
                      f"Unable to initialize hub logger. Disabling hub logging: {ex}"
                  )
                  hub_logger = None
              if hub_logger is not None:
                  log_writers.append(hub_logger)
  
      return log_writers
  
file_path: ml-cvnets/engine/utils.py
imports: import argparse
  from typing import Dict, List, Optional, Union
  import torch
  from torch import Tensor
  from torch.cuda.amp import autocast
  from utils import logger
  from utils.common_utils import create_directories
  from utils.ddp_utils import is_master
label_desc: Use image node_id 4 for calling a global function with example usage: get_log_writers(opts, save_location) and returns: log_writers, log_writers