def logging_config(logpath=None,<EOL>level=logging.DEBUG,<EOL>console_level=logging.INFO,<EOL>no_console=False):
logger = logging.getLogger('<STR_LIT>')<EOL>for handler in logger.handlers:<EOL><INDENT>logger.removeHandler(handler)<EOL><DEDENT>logger.handlers = []<EOL>logger.propagate = False<EOL>logger.setLevel(logging.DEBUG)<EOL>formatter = logging.Formatter('<STR_LIT>')<EOL>if logpath is not None:<EOL><INDENT>print('<STR_LIT>'.format(logpath))<EOL>logfile = logging.FileHandler(logpath, mode='<STR_LIT:w>')<EOL>logfile.setLevel(level)<EOL>logfile.setFormatter(formatter)<EOL>logger.addHandler(logfile)<EOL><DEDENT>if not no_console:<EOL><INDENT>logconsole = logging.StreamHandler()<EOL>logconsole.setLevel(console_level)<EOL>logconsole.setFormatter(formatter)<EOL>logger.addHandler(logconsole)<EOL><DEDENT>
Config the logging.