

def init_log(logger, filename=None, loglevel=None):
    '\n    Initializes the log file in the proper format.\n\n    Arguments:\n\n        filename (str): Path to a file. Or None if logging is to\n                         be disabled.\n        loglevel (str): Determines the level of the log output.\n    '
    template = '[%(asctime)s] %(levelname)-8s: %(name)-25s: %(message)s'
    formatter = logging.Formatter(template)
    if loglevel:
        logger.setLevel(getattr(logging, loglevel))
    console = logging.StreamHandler()
    console.setLevel('WARNING')
    console.setFormatter(formatter)
    if filename:
        file_handler = logging.FileHandler(filename, encoding='utf-8')
        if loglevel:
            file_handler.setLevel(getattr(logging, filename))
        file_handler.setFormatter(formatter)
        logger.addHandler(file_handler)
    elif loglevel:
        console.setLevel(getattr(logging, loglevel))
    logger.addHandler(console)

dataset/ETHPy150Open moonso/genmod/genmod/log.py init_log/VarMisuse@104/239 `loglevel`->`filename`