Caller's module name, function/method name and line number for output to logging
Peter Otten
__peter__ at web.de
Tue Jul 26 02:47:44 EDT 2016
Malcolm Greene wrote:
> Hi Terry,
>
>>> Is there a technique for accessing a function's *CALLER* module name,
>>> function/method name and line number so that this information can be
>
>> Look in the inspect module for the inspect stack function. Note that
>> when you call the function, it needs to look 2 levels up.
>
> Perfect! That's exactly what I was looking for.
Fine! Then you can avoid the evil hack I came up with many moons ago:
https://mail.python.org/pipermail/python-list/2010-March/570941.html
;)
More information about the Python-list
mailing list