[BangPypers] FW: Exception file, lineno, method inforamtion needed

Noufal Ibrahim noufal at gmail.com
Mon Oct 26 13:45:39 CET 2009


On Mon, Oct 26, 2009 at 5:41 PM, Anand Balachandran Pillai
<abpillai at gmail.com> wrote:
[..]
>    Now, the log()  method under Test above is under log.py and uses the
> logging module of python with the following format specifications. When we
> print the e under log, what i wanted is the information trace pertaining to
> Method.py like where actually the line no,filename and module name
> information under method.py to be printed. Currently,iam not getting what i
> wanted.

If this is what you want, the logging call should be inside Method.py.

You should publish (as part of your API), the logging class which
calling applications can modify (add/remove handlers etc.) so that
they can get desired behaviour.

It would be a bug if you made a logging call inside Test.py and it
said that it was being called from Method.py

OTOH, if you explicitly want the details of which module/class etc. of
the callee, you can get it from the stack frame.



-- 
~noufal
http://nibrahim.net.in


More information about the BangPypers mailing list