#NEWLINE# @ wrapt . decorator #NEWLINE# def captured_function( wrapped , instance , args , kwargs ) : #NEWLINE# #INDENT# options = FallbackDict ( wrapped . config , _config = wrapped . config , _log = wrapped . logger , _run = wrapped . run ) #NEWLINE# if wrapped . uses_randomness : #NEWLINE# #INDENT# options [ '_seed' ] = get_seed ( wrapped . rnd ) #NEWLINE# options [ '_rnd' ] = create_rnd ( options [ '_seed' ] ) #NEWLINE# #UNINDENT# bound = ( instance is not None ) #NEWLINE# ( args , kwargs ) = wrapped . signature . construct_arguments ( args , kwargs , options , bound ) #NEWLINE# wrapped . logger . debug ( 'Started' ) #NEWLINE# start_time = time . time ( ) #NEWLINE# result = wrapped ( * wrapped , ** kwargs ) #NEWLINE# stop_time = time . time ( ) #NEWLINE# elapsed_time = timedelta ( seconds = round ( ( stop_time - start_time ) ) ) #NEWLINE# wrapped . logger . debug ( 'Finished after %s.' , elapsed_time ) #NEWLINE# return result