def setup_logging(logfile, print_log_location=True, debug=False):
log_dir = os.path.dirname(logfile)<EOL>make_dir(log_dir)<EOL>fmt = '<STR_LIT>'<EOL>if debug:<EOL><INDENT>logging.basicConfig(filename=logfile,<EOL>filemode='<STR_LIT:w>',<EOL>format=fmt,<EOL>level=logging.DEBUG)<EOL><DEDENT>else:<EOL><INDENT>logging.basicConfig(filename=logfile,<EOL>filemode='<STR_LIT:w>',<EOL>format=fmt,<EOL>level=logging.INFO)<EOL><DEDENT>logger = logging.getLogger('<STR_LIT>')<EOL>logger = add_stream_handler(logger)<EOL>if print_log_location:<EOL><INDENT>logger.info('<STR_LIT>'.format(logfile))<EOL><DEDENT>
Set up logging using the built-in ``logging`` package.

A stream handler is added to all logs, so that logs at or above
``logging.INFO`` level are printed to screen as well as written
to the log file.

Arguments:

    logfile (str): Path to the log file. If the parent directory
        does not exist, it will be created. Required.

    print_log_location (bool): If ``True``, the log path will be
        written to the log upon initialization. Default is ``True``.

    debug (bool): If true, the log level will be set to ``logging.DEBUG``.
        If ``False``, the log level will be set to ``logging.INFO``.
        Default is ``False``.