On 7/25/2016 3:16 PM, Malcolm Greene wrote:
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.

passed to a logging library's logger? I have a routine that detects an
error condition, but I want to report the error's context relative to
the caller, not the current function. TD;LR: I want to peek 1 level up
the call stack for this information. A bonus would be a way to have my
logger use info vs the current %(module)s, %(funcName)s, and
%(lineno)d values.


--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to