예제 #1
0
def test_match():

    # Match based on string
    with capture_log('info', 'foo') as log:
        logger.info('AA foo')
        logger.info('BB bar')  # no foo
        logger.debug('CC foo')  # too high level
        logger.info('DD fXo')  # no foo

    assert len(log) == 1
    assert 'AA' in log[0]

    # Match based on regexp
    with capture_log('info', re.compile('f.o')) as log:
        logger.info('AA foo')
        logger.info('BB bar')  # no foo
        logger.debug('CC foo')  # too high level
        logger.info('DD fXo')

    assert len(log) == 2
    assert 'AA' in log[0]
    assert 'DD' in log[1]

    # No match
    with capture_log('info', '') as log:
        logger.info('AA foo')
        logger.info('BB bar')
        logger.debug('CC foo')  # too high level
        logger.info('DD fXo')

    assert len(log) == 3
예제 #2
0
def test_match():

    # Match based on string
    with capture_log('info', 'foo') as log:
        logger.info('AA foo')
        logger.info('BB bar')  # no foo
        logger.debug('CC foo')  # too high level
        logger.info('DD fXo')  # no foo

    assert len(log) == 1
    assert 'AA' in log[0]

    # Match based on regexp
    with capture_log('info', re.compile('f.o')) as log:
        logger.info('AA foo')
        logger.info('BB bar')  # no foo
        logger.debug('CC foo')  # too high level
        logger.info('DD fXo')

    assert len(log) == 2
    assert 'AA' in log[0]
    assert 'DD' in log[1]

    # No match
    with capture_log('info', '') as log:
        logger.info('AA foo')
        logger.info('BB bar')
        logger.debug('CC foo')  # too high level
        logger.info('DD fXo')

    assert len(log) == 3
예제 #3
0
 def caller_func_bla():
     logger.debug('AA foo')
     logger.info('BB bar')
예제 #4
0
def test_debug():

    logger.debug('test')
예제 #5
0
 def caller_func_bla():
     logger.debug('AA foo')
     logger.info('BB bar')
예제 #6
0
def test_debug():

    logger.debug('test')