code: def _create_handler(self, handler_class, level):
          
          if handler_class == logging.StreamHandler:
              handler = handler_class()
              handler.setLevel(level)
          elif handler_class == logging.handlers.SysLogHandler:
              handler = handler_class(address='/dev/log')
              handler.setLevel(level)
          elif handler_class == logging.handlers.TimedRotatingFileHandler:
              handler = handler_class(self.filename, when='midnight')
              handler.setLevel(level)
          elif handler_class == AlkiviEmailHandler:
              handler = handler_class(mailhost='127.0.0.1',
                                      fromaddr="%s@%s" % (USER, HOST),
                                      toaddrs=self.emails,
                                      level=self.min_log_level_to_mail)
              # Needed, we want all logs to go there
              handler.setLevel(0)
  
          formatter = self.get_formatter(handler)
          handler.setFormatter(formatter)
          self.handlers.append(handler)
          self.logger.addHandler(handler)
docs: Create an handler for at specific level.