Source line number for log purpose (newbie)

Siggy Brentrup bsb at baal.infodrom.north.de
Sat Sep 25 12:57:37 EDT 1999


"T. C. Mits" <71351.356 at compuserve.com> writes:

> Ok.  I looked in Exception library and don't see the relevance.   I am
> logging normal code, not exceptions.   For example,
> log.prtl( SERIOUS, "About to create dest file %s" % newfilename)
> 
> In this case, to help maintainers of the code, I want to also log the line
> number where this statement is found in the source.
> 
> I'm now thinking this has to done by digging into the Python extension
> mechanisms and system variables deep in the system?

It's easy, feel free to use the attached code (quoted-printable to get 
tabs right)

CU
  Siggy

[...]

-------------- next part --------------
A non-text attachment was scrubbed...
Name: lineno.py
Type: application/octet-stream
Size: 359 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/19990925/168d11e8/attachment.obj>


More information about the Python-list mailing list