import logging


def setupLogging(logfileName, logFormat, logLevel, logToConsole=True):
    """
    Setup simultaneous logging to file and console.
    """
    # logFormat = "%(asctime)s %(levelname)s %(funcName)s:%(lineno)d
    # %(message)s"
    logging.basicConfig(filename=logfileName, level=logging.NOTSET,
                        format=logFormat)
    if logToConsole:
        console = logging.StreamHandler()
        console.setLevel(logLevel)
        formatter = logging.Formatter(logFormat)
        console.setFormatter(formatter)
        logging.getLogger('').addHandler(console)
    return None