code: def add_handler(cls, level, fmt, colorful, **kwargs):
      
      global g_logger
   
      if isinstance(level, str):
          level = getattr(logging, level.upper(), logging.DEBUG)
   
      handler = cls(**kwargs)
      handler.setLevel(level)
   
      if colorful:
          formatter = ColoredFormatter(fmt, datefmt='%Y-%m-%d %H:%M:%S')
      else:
          formatter = logging.Formatter(fmt, datefmt='%Y-%m-%d %H:%M:%S')
   
      handler.setFormatter(formatter)
      g_logger.addHandler(handler)
   
      return handler
docs: Add a configured handler to the global logger.