code: def setup_logging():
      """Sets up the logging."""
      # Enable logging only for the main process
      if dist.is_main_proc():
          # Clear the root logger to prevent any existing logging config
          # (e.g. set by another module) from messing with our setup
          logging.root.handlers = []
          # Construct logging configuration
          logging_config = {"level": logging.INFO, "format": _FORMAT}
          # Log either to stdout or to a file
          if cfg.LOG_DEST == "stdout":
              logging_config["stream"] = sys.stdout
          else:
              logging_config["filename"] = os.path.join(
                  cfg.OUT_DIR, _LOG_FILE
              )
          # Configure logging
          logging.basicConfig(**logging_config)
      else:
          _suppress_print()
  
file_path: pycls/pycls/core/logging.py
imports: import builtins
  import decimal
  import logging
  import os
  import sys
  import pycls.core.distributed
  import simplejson
  from pycls.core.config import cfg
  from pycls.core.io import pathmgr
label_desc: Use image node_id 2 for calling a global function with example usage: setup_logging() without return types