def _init_logging(anteater_log):
    """ Setup root logger for package """

    LOG.setLevel(logging.DEBUG)
    ch = logging.StreamHandler()
    formatter = logging.Formatter('%(asctime)s - %(name)s - '
                                  '%(levelname)s - %(message)s')
    ch.setFormatter(formatter)
    ch.setLevel(logging.DEBUG)

    # create the directory if it does not exist
    path = os.path.dirname(anteater_log)
    try:
        os.makedirs(path)
    except OSError as e:
        if e.errno != errno.EEXIST:
            raise

    handler = logging.FileHandler(anteater_log)
    handler.setFormatter(formatter)
    handler.setLevel(logging.DEBUG)
    del logging.root.handlers[:]
    logging.root.addHandler(ch)
    logging.root.addHandler(handler)
def _init_logging ( anteater_log ) : LOG . setLevel ( logging . DEBUG ) ch = logging . StreamHandler ( ) formatter = logging . Formatter ( '%(asctime)s - %(name)s - ' '%(levelname)s - %(message)s' ) ch . setFormatter ( formatter ) ch . setLevel ( logging . DEBUG ) path = os . path . dirname ( anteater_log ) try : os . makedirs ( path ) except OSError as e : if e . errno != errno . EEXIST : raise handler = logging . FileHandler ( anteater_log ) handler . setFormatter ( formatter ) handler . setLevel ( logging . DEBUG ) del logging . root . handlers [ : ] logging . root . addHandler ( ch ) logging . root . addHandler ( handler )
Setup root logger for package