code: def setup_logger(log=None, level=logging.INFO):
      
      if not log:
          log = logging.getLogger()
      if not log.handlers:
          channel = logging.StreamHandler()
          if level == logging.DEBUG:
              channel.setFormatter(DebugLogFormatter())
          else:
              channel.setFormatter(LogFormatter())
  
          log.setLevel(level)
          log.addHandler(channel)
docs: Setup logging for CLI use.
      :param log: instance of logger
      :type log: :py:class:`Logger`