#NEWLINE# @ decorator #NEWLINE# def log_calls( call , print_func , errors = True , stack = True ) : #NEWLINE# #INDENT# signature = signature_repr ( call ) #NEWLINE# try : #NEWLINE# #INDENT# print_func ( ( 'Call %s' % signature ) ) #NEWLINE# result = call ( ) #NEWLINE# print_func ( ( '-> %s from %s' % ( smart_repr ( result , max_len = None ) , signature ) ) ) #NEWLINE# return result #NEWLINE# #UNINDENT# except BaseException as e : #NEWLINE# #INDENT# if errors : #NEWLINE# #INDENT# print_func ( ( '-> ' + _format_error ( signature , e , stack ) ) ) #NEWLINE# #UNINDENT# raise