A simple python decorator.
def logcall(f):
def wrapper(*a, **opts):
print('calling ' + f.__name__)
f(*a, **opts)
print('called ' + f.__name__)
return wrapper
@logcall
def square(x):
print 'result: ' + str(x * x)
return x * x
square(2)