code: def setup(level: int = logging.INFO, log_colors: bool = True) -> None:
      colorama.init()
  
      color_out = (
          log_colors and bool(sys.stdout) and sys.stdout.isatty()
      )
      color_err = (
          log_colors and bool(sys.stderr) and sys.stderr.isatty()
      )
  
      formatter = ColorFormatter(log_colors=color_out)
  
      console_info = LoggerHandler(sys.stdout)
      console_info.setLevel(logging.INFO)
      console_info.setFormatter(formatter)
      console_info.addFilter(exclude_filter(logging.WARNING))
  
      console_debug = LoggerHandler(sys.stdout)
      console_debug.setLevel(logging.DEBUG)
      console_debug.setFormatter(formatter)
      console_debug.addFilter(exclude_filter(logging.INFO))
  
      add_logging_level("TRACE", logging.DEBUG - 5)
  
      console_trace = LoggerHandler(sys.stdout)
      console_trace.setLevel(logging.TRACE)  # type: ignore[attr-defined]
      console_trace.setFormatter(formatter)
      console_trace.addFilter(exclude_filter(logging.DEBUG))
  
      show_traceback = bool(os.environ.get("DVC_SHOW_TRACEBACK"))
      err_formatter = ColorFormatter(
          log_colors=color_err, show_traceback=show_traceback
      )
      console_errors = LoggerHandler(sys.stderr)
      console_errors.setLevel(logging.WARNING)
      console_errors.setFormatter(err_formatter)
  
      for name in ["dvc", "dvc_objects", "dvc_data"]:
          logger = logging.getLogger(name)
          logger.setLevel(level)
          for handler in [
              console_info,
              console_debug,
              console_trace,
              console_errors,
          ]:
              logger.addHandler(handler)
  
      if level >= logging.DEBUG:
          # Unclosed session errors for asyncio/aiohttp are only available
          # on the tracing mode for extensive debug purposes. They are really
          # noisy, and this is potentially somewhere in the client library
          # not managing their own session. Even though it is the best practice
          # for them to do so, we can be assured that these errors raised when
          # the object is getting deallocated, so no need to take any extensive
          # action.
          logging.getLogger("asyncio").setLevel(logging.CRITICAL)
          logging.getLogger("aiohttp").setLevel(logging.CRITICAL)
  
imports: import logging
  import logging.config
  import logging.handlers
  import os
  import sys
  import colorama
  from dvc.progress import Tqdm
label_desc: Use image node_id 6 for calling a global function with example usage: setup(level, log_colors) without return types