some kind of trace facility ?

Michele Simionato michele.simionato at gmail.com
Sun Aug 10 13:57:02 EDT 2008


On Aug 10, 1:14 am, Stef Mientki <stef.mien... at gmail.com> wrote:
> hello,
>
> I want to investigate on a regular base the flow of my Python (most of
> them using wxPython) programs.
> So I want to have some log facilty, that logs things like
> - every time a function / method is called
> - the time spent in that function / method (or even better start /
> finish time)
> - in case the function / method has some predefined variables, the
> values of these variables
> - the caller
>
> As an extra condition, I'm only interested in my own program modules
> (located in a specific subdirectory).
>
> Is there a module available that can perform such a task ?
> Any hints to get started ?
>
> thanks,
> Stef Mientki

I second the suggestion of using a custom decorator.
Also, look at the facilities provided by the
inspect module, at sys._getframe() and similar
things. Looking at the introspection tricks used
in the source code of the
decorator module may be of help:

http://www.phyast.pitt.edu/~micheles/python/documentation.html



More information about the Python-list mailing list