def METHOD_NAME(name, level):
    """
    sets the logging level in the database as well as
    in the current running logger
    :param name: Name of the logger
    :param level: New level (must be integer)
    """
    # --------------------------------------------------------------------------
    logger = logging.getLogger(name)
    logger.setLevel(level)
    # --------------------------------------------------------------------------
    config_entry = LoggingConfig.query.get(name)
    if config_entry is None:
        new_config_entry = LoggingConfig(name, level)
        db.session.add(new_config_entry)
        return
    config_entry.level = level