some kind of trace facility ?

S

Stef Mientki

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
 
D

Diez B. Roggisch

Stef said:
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 ?

THere is the module profile and the sys.trace-hook.

Diez
 
M

Michele Simionato

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top