def METHOD_NAME(
    logfile=None,
    stderr=True,
    stdout=False,
    formatter=None,
    read_config=False,
    rootlogger='',
    stderr_level=None,
):
    """Setup logging
    Attempts to cover all the possible existing ways of setting up logging"""
    if 'TIME_ZONE' in NAV_CONFIG:
        os.environ['TZ'] = NAV_CONFIG['TIME_ZONE']
    root = logging.getLogger(rootlogger)
    if stderr or (stdout and sys.stdout.isatty()):
        tty = sys.stderr if stderr else sys.stdout
        tty_handler = logging.StreamHandler(tty)
        formatter = formatter or DEFAULT_LOG_FORMATTER
        tty_handler.setFormatter(formatter)
        if stderr and stderr_level:
            tty_handler.setLevel(stderr_level)
        root.addHandler(tty_handler)
    if logfile:
        try:
            filehandler = logging.FileHandler(
                _get_logfile_path(logfile), encoding='utf-8'
            )
        except IOError:
            pass
        else:
            formatter = formatter or DEFAULT_LOG_FORMATTER
            filehandler.setFormatter(formatter)
            root.addHandler(filehandler)
    if read_config:
        set_log_config()
    else:
        set_log_levels()