def logging_config(folder=None, name=None,<EOL>level=logging.DEBUG,<EOL>console_level=logging.INFO,<EOL>no_console=False):
if name is None:<EOL><INDENT>name = inspect.stack()[<NUM_LIT:1>][<NUM_LIT:1>].split('<STR_LIT:.>')[<NUM_LIT:0>]<EOL><DEDENT>if folder is None:<EOL><INDENT>folder = os.path.join(os.getcwd(), name)<EOL><DEDENT>if not os.path.exists(folder):<EOL><INDENT>os.makedirs(folder)<EOL><DEDENT>for handler in logging.root.handlers:<EOL><INDENT>logging.root.removeHandler(handler)<EOL><DEDENT>logging.root.handlers = []<EOL>logpath = os.path.join(folder, name + '<STR_LIT>')<EOL>print('<STR_LIT>'.format(logpath))<EOL>logging.root.setLevel(level)<EOL>formatter = logging.Formatter('<STR_LIT>')<EOL>logfile = logging.FileHandler(logpath)<EOL>logfile.setLevel(level)<EOL>logfile.setFormatter(formatter)<EOL>logging.root.addHandler(logfile)<EOL>if not no_console:<EOL><INDENT>logconsole = logging.StreamHandler()<EOL>logconsole.setLevel(console_level)<EOL>logconsole.setFormatter(formatter)<EOL>logging.root.addHandler(logconsole)<EOL><DEDENT>return folder<EOL>
Config the logging.

    Parameters
    ----------
    folder : str or None
    name : str or None
    level : int
    console_level
    no_console: bool
        Whether to disable the console log
    Returns
    -------
    folder : str
        Folder that the logging file will be saved into.