def get_logger(name=None, format_string=None):
    """
    :type name: str
    :param name: used for declaring log channels.

    :type format_string: str
    :param format_string: for custom formatting
    """
    logging.captureWarnings(True)
    log = logging.getLogger(name)

    # Bind custom method to instance.
    # Source: https://stackoverflow.com/a/2982
    log.set_debug_level = _set_debug_level.__get__(log)
    log.set_debug_level(0)

    if not format_string:
        format_string = '[%(module)s]\t%(levelname)s\t%(message)s'

    # Setting up log formats
    log.handlers = []
    handler = logging.StreamHandler(sys.stderr)
    handler.setFormatter(
        logging.Formatter(format_string),
    )
    log.addHandler(handler)

    return log
def get_logger ( name = None , format_string = None ) : logging . captureWarnings ( True ) log = logging . getLogger ( name ) log . set_debug_level = _set_debug_level . __get__ ( log ) log . set_debug_level ( 0 ) if not format_string : format_string = '[%(module)s]\t%(levelname)s\t%(message)s' log . handlers = [ ] handler = logging . StreamHandler ( sys . stderr ) handler . setFormatter ( logging . Formatter ( format_string ) , ) log . addHandler ( handler ) return log
:type name: str
    :param name: used for declaring log channels.

    :type format_string: str
    :param format_string: for custom formatting