Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #111880

Re: Caller's module name, function/method name and line number for output to logging

From Peter Otten <__peter__@web.de>
Newsgroups comp.lang.python
Subject Re: Caller's module name, function/method name and line number for output to logging
Date 2016-07-26 08:47 +0200
Organization None
Message-ID <mailman.123.1469515692.22221.python-list@python.org> (permalink)
References <1469474181.734306.676367265.29267D36@webmail.messagingengine.com> <nn5v29$tri$1@ger.gmane.org> <1469486429.2217869.676546129.5F3AEEE4@webmail.messagingengine.com> <nn712v$66o$1@ger.gmane.org>

Show all headers | View raw


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

;)

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Caller's module name, function/method name and line number for output to logging Peter Otten <__peter__@web.de> - 2016-07-26 08:47 +0200

csiph-web