to be pythonic: should caller or callee log?

Gildor Oronar gildororonar at mail-on.us
Wed Sep 4 03:44:17 EDT 2013


El 04/09/13 10:26, Ethan Furman escribió:

> I would say it is not really the caller's or the callee's job to do the
> logging, even though it should be done.  What would be really handy is a
> function that sat in between the caller and callee that logged for you
> -- you know, a decorator:

Thanks a lot! My knowledge to decorator is so limited to @staticmethod 
that I don't know I can write my own decorator. This is a good lesson to 
learn.

Your example lead me to explore and find this article which addressed 
the case of using decorator to log:

http://simeonfranklin.com/blog/2012/jul/1/python-decorators-in-12-steps/
(To googler who find this post: search 'log' in the above article)



More information about the Python-list mailing list