docs: def set_logger(name,
                 level='INFO',
                 fmt=None,
                 datefmt=None,
                 propagate=1,
                 remove_handlers=False):
      """
      This function will clear the previous handlers and set only one handler,
      which will only be StreamHandler for the logger.
  
      This function is designed to be able to called multiple times in a context.
  
      Note that if a logger has no handlers, it will be added a handler automatically when it is used.
      """
      logger = logging.getLogger(name)
      logger.setLevel(getattr(logging, level))
      logger.propagate = propagate
  
      if remove_handlers:
          logger.handlers = []
          return
  
      handler = None
      for h in logger.handlers:
          if isinstance(h, logging.StreamHandler):
              # use existing instead of clean and create
              handler = h
              break
      if not handler:
          handler = logging.StreamHandler()
          logger.addHandler(handler)
  
      formatter_kwgs = {}
      for i in ('fmt', 'datefmt'):
          if locals()[i] is not None:
              formatter_kwgs[i] = locals()[i]
      handler.setFormatter(BaseFormatter(**formatter_kwgs))