print line number and source filename

Stephen Hansen me+list/python at ixokai.io
Thu Jun 24 11:28:50 EDT 2010


On Wed, Jun 23, 2010 at 8:07 PM, Peng Yu <pengyu.ut at gmail.com> wrote:

> I tried to put the above code in a module. Say in a.b.__init__.py
>
> %(module)s only print to "__init__". However, I need the fullname
> a.b.__init__. I looked at the manual, but I don't see what format
> string I should supply. Would you please let me know?


If you look at the manual you'll find:

http://docs.python.org/library/logging.html#formatter

To which %(pathname)s appears to be what you're looking for.

--S
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100624/06ed729b/attachment-0001.html>


More information about the Python-list mailing list