def METHOD_NAME(msg, level='INFO', html=False):
    """Writes the message to the log file using the given level.
    Valid log levels are ``TRACE``, ``DEBUG``, ``INFO`` (default), ``WARN``,
    and ``ERROR``. In addition to that, there are pseudo log levels ``HTML``
    and ``CONSOLE`` for logging messages as HTML and for logging messages
    both to the log file and to the console, respectively. With both of these
    pseudo levels the level in the log file will be ``INFO``. The ``CONSOLE``
    level is new in Robot Framework 6.1.
    Instead of using this method, it is generally better to use the level
    specific methods such as ``info`` and ``debug`` that have separate
    ``html`` argument to control the message format.
    """
    if EXECUTION_CONTEXTS.current is not None:
        librarylogger.METHOD_NAME(msg, level, html)
    else:
        logger = logging.getLogger("RobotFramework")
        level = {'TRACE': logging.DEBUG // 2,
                 'DEBUG': logging.DEBUG,
                 'INFO': logging.INFO,
                 'CONSOLE': logging.INFO,
                 'HTML': logging.INFO,
                 'WARN': logging.WARN,
                 'ERROR': logging.ERROR}[level]
        logger.log(level, msg)