def test_debug_logging():
 with use_log_level('debug', 'Selected', True, False) as l:
  logger.debug('Selected foo')
 assert_equal(len(l), 1)
 assert_in('test_logging', l[0])
 with use_log_level('debug', record=True, print_msg=False) as l:
  logger.debug('foo')
 assert_equal(len(l), 1)
 assert_in('test_logging', l[0])
 with use_log_level('debug', 'foo', True, False) as l:
  logger.debug('bar')
 assert_equal(len(l), 0)
 with use_log_level('info', record=True, print_msg=False) as l:
  logger.debug('foo')
  logger.info('bar')
 assert_equal(len(l), 1)
 assert_not_in('unknown', l[0])

def test_debug_logging ( ) : with use_log_level ( 'debug' , 'Selected' , True , False ) as l : logger . debug ( 'Selected foo' ) assert_equal ( len ( l ) , 1 ) assert_in ( 'test_logging' , l [ 0 ] ) with use_log_level ( 'debug' , record = True , print_msg = False ) as l : logger . debug ( 'foo' ) assert_equal ( len ( l ) , 1 ) assert_in ( 'test_logging' , l [ 0 ] ) with use_log_level ( 'debug' , 'foo' , True , False ) as l : logger . debug ( 'bar' ) assert_equal ( len ( l ) , 0 ) with use_log_level ( 'info' , record = True , print_msg = False ) as l : logger . debug ( 'foo' ) logger . info ( 'bar' ) assert_equal ( len ( l ) , 1 ) assert_not_in ( 'unknown' , l [ 0 ] )
test advanced debugging logging .