Creating logged functions using decorators
ratchetgrid at googlemail.com
Sat Jul 7 20:47:12 CEST 2007
I m thinking about writing some code which logs the input and output
of a function/script and stores it in a database using sqlalchemy
(although I havent started on this yet). I want to do this via a
decorator ( I think this is the best way ).
def doAnalysis(a, b):
print a, b
return a + b
I can access the arguments passed to the "logged" function, but is
there anyway I can capture the output of the function i.e. 10.
Many Thanks in advance,
More information about the Python-list