def METHOD_NAME(
    filename: Optional[str] = None,
    level: str = 'INFO',
    to_console: bool = True,
    to_file: bool = True,
) -> None:
    """After initialization, start file logging."""
    global _logging_started, _startup_buffer, _startup_buffer_id
    assert _logging_configured
    if _logging_started:
        return
    if level == 'NONE':
        return
    # Make sure stdlib logger is set so that dependency logging gets propagated
    logging.getLogger().setLevel(logger.level(level).no)
    if to_file and filename:
        logger.add(
            filename,
            level=level,
            rotation=int(os.environ.get(ENV_MAXBYTES, 1000 * 1024)),
            retention=int(os.environ.get(ENV_MAXCOUNT, 9)),
            encoding='utf-8',
            format=LOG_FORMAT,
            filter=_log_filterer,
        )
    # without --cron we log to console
    if to_console:
        if not sys.stdout:
            logger.debug("No sys.stdout, can't log to console.")
        else:
            # Make sure we don't send any characters that the current terminal doesn't support printing
            sys.stdout.reconfigure(errors='replace')
            logger.add(sys.stdout, level=level, format=LOG_FORMAT, filter=_log_filterer)
    if _startup_buffer_id is not None:
        logger.remove(_startup_buffer_id)
        _startup_buffer_id = None
    # flush what we have stored from the plugin initialization
    if _startup_buffer:
        for record in _startup_buffer:
            level, message = record['level'].name, record['message']
            logger.patch(lambda r: r.update(record)).log(level, message)
        _startup_buffer = []
    _logging_started = True