Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(3)  |  Call(3)  |  Derive(0)  |  Import(0)
(Re)configure the default logger.
    

        def reset(level=logging.INFO, handlers=None):
    """(Re)configure the default logger.
    """

    new_logger = logging.getLogger(ROOT_NAME)

    # might be an existing object, reset it
    for handler in new_logger.handlers:
        new_logger.removeHandler(handler)
    for filter in new_logger.filters:
        new_logger.removeFilter(filter)

    # configure
    if handlers is None:
        new_logger.addHandler(logging.StreamHandler(sys.stdout))
    else:
        for handler in handlers:
            new_logger.addHandler(handler)
    new_logger.level = level

    # use
    global log
    log = new_logger
        


src/f/e/feedplatform-HEAD/feedplatform/lib/addins/doers/daemons.py   feedplatform(Download)
 
        if loglevel or handlers:
            log.reset(level=loglevel, handlers=handlers)
 
 

src/f/e/feedplatform-HEAD/tests/test/test_basic.py   feedplatform(Download)
    sys.stdout = StringIO()
    try:
        log.reset()
 
        feedev.testmod()
        sys.stdout.seek(0)
        stdout = sys.stdout.read()
    finally:
        sys.stdout = old_stdout
        log.reset()