Trace function with automatic source code location reporting

Uwe.Hoffmann at bc.boehringer-ingelheim.com Uwe.Hoffmann at bc.boehringer-ingelheim.com
Thu Feb 8 03:03:24 EST 2001


Hi!

Jürgen Hermann wrote:

>>The following is the core of a tracing function, is there any less obscure
>>                 way to get the location of the caller?


Maybe you are looking for :            
	tb = traceback.extract_stack()[-2]
            print "%s,%i,%s: " %(tb[0],tb[1],tb[2],) ,

Regards
	Uwe




More information about the Python-list mailing list