def _add_urbansim_handler(handler, level=None, fmt=None, datefmt=None,
                          propagate=None):
    """
    Add a logging handler to urbansim.

    Parameters
    ----------
    handler : logging.Handler subclass
    level : int, optional
        An optional logging level that will apply only to this stream
        handler.
    fmt : str, optional
        An optional format string that will be used for the log
        messages.
    datefmt : str, optional
        An optional format string for formatting dates in the log
        messages.
    propagate : bool, optional
        Whether the urbansim logger should propagate. If None the
        propagation will not be modified, otherwise it will be set
        to this value.

    """
    if not fmt:
        fmt = US_LOG_FMT
    if not datefmt:
        datefmt = US_LOG_DATE_FMT

    handler.setFormatter(logging.Formatter(fmt=fmt, datefmt=datefmt))

    if level is not None:
        handler.setLevel(level)

    logger = logging.getLogger('urbansim')
    logger.addHandler(handler)

    if propagate is not None:
        logger.propagate = propagate
dataset/ETHPy150Open UDST/urbansim/urbansim/utils/logutil.py/_add_urbansim_handler/original