Source line number for log purpose (newbie)

Gerrit Holl gerrit.holl at pobox.com
Sat Sep 25 07:04:31 EDT 1999


T. C. Mits:
> In c there was a way to get the current source line number via a macro,
> __LINE__.
> 
> I need to be able to do the same thing.  I created a logger class that uses
> a level setting.  At high levels I want to
> log the source line number where the inline log.prtl( level, msg) method
> call appears.
> 
> I'm sure this is easy but am getting lost digging through the Python source
> and docs.
> 

That's possible via the 'Exception' module.

regards,
Gerrit.
-- 
RTFM: Read That FreshMeat




More information about the Python-list mailing list