def test_lazy_log():
 called_print = []
 class Expensive(object, ):
  def __repr__(self):
   called_print.append(1)
   return 'expensive data preparation'
 slogging.configure(log_json=True)
 log = slogging.get_logger()
 log.trace('no', data=Expensive())
 assert (not called_print)
 log.info('yes', data=Expensive())
 assert called_print.pop()

def test_lazy_log ( ) : called_print = [ ] class Expensive ( object , ) : def __repr__ ( self ) : called_print . append ( 1 ) return 'expensive data preparation' slogging . configure ( log_json = True ) log = slogging . get_logger ( ) log . trace ( 'no' , data = Expensive ( ) ) assert ( not called_print ) log . info ( 'yes' , data = Expensive ( ) ) assert called_print . pop ( )
test lacy evaluation of json log data e .