import logging


def init_logger(
    _logger: logging.RootLogger,
    log_level: int,
    log_file: str
) -> logging.RootLogger:
    """Initialise the logger.

    :param logging.RootLogger _logger: Logger instance to initialise.
    :param int log_level: Desidered logging level (e.g. ``logging.INFO``).
    :param str log_file: Path to destination file for logging output. If no
        output file is provided (``log_file`` is ``None``) logs will be written
        to standard output.
    :return: The initialised logger object.
    :rtype: logging.RootLogger

    """
    # Initialise the logger
    _logger.setLevel(log_level)

    if log_file is not None:
        handler = logging.FileHandler(filename=log_file, mode='w')
    else:
        handler = logging.StreamHandler()

    formatter = logging.Formatter(
            '%(asctime)s %(name)-12s %(levelname)-8s %(message)s'
            )
    handler.setFormatter(formatter)
    _logger.addHandler(handler)

    _logger.info("Logger successfully initialised")
    return _logger