How to automatically log the entry/exit of methods in Xojo?

In Java , I am using AspectJ for automatic log of methods. In Xojo, how I can do the same ?

there is nothing that logs this automatically

there is a constant, currentmethodname, that you can write to a log

but there’s nothing like aspects in Xojo

I’m not familiar with AspectJ but for a framework written in C++ I used to have a Class in which the Constructor was set to Log informations about the entered Method. Then same thing in the Class Destructor. This way the logging system allowed hierarchical logs so you could see the exact hierarchy of Method calls.

This is transposable to Xojo, although you will have to create your class instance on the heap instead of the stack. But it should work.

Not sure if this is what you are after though.

May I ask why you want this? Would the Profiler do what you need?

Have a look at Thomas Tempelmann blog:

Debugging Tips

It’s not an automatic way as you ask, but I use this technique in some cases.

I want that for the hierarchy of Method calls and time spending each time . Right now, I am using a similar way as Amando proposed.

The profiler already does this for you

There are situations where you want to integrate a hierarchical login system inside a released application, were debugging per say is not possible. This may allow the user to figure out some issues.

You can build with profiling on and it will dump the results into a text file
Analyzing the raw data is the challenge

[quote=84363:@Norman Palardy]You can build with profiling on and it will dump the results into a text file
Analyzing the raw data is the challenge[/quote]

How you can do that ? Can I activate or deactivate this feature on runtime ?

Project > Profile Code
Build

No you cannot turn this on & off at runtime as the actual profiler won’t even exist or have been added if its not on at compile time