1

I have dozens of Classes with a unique ParentClass, i need implements a way to create a log each time any method is executed !

Have a way to do this only in the ParentClass or something like?

thanks, Celso

celsowm
  • 846
  • 9
  • 34
  • 59
  • 2
    You dont have that need. If you need to debug or profile your application, use a Debugger/Profiler like XDebug. – Gordon Sep 08 '11 at 13:29
  • [KLogger](http://codefury.net/projects/klogger/) is good if you want to have a simple to use logger in your system – afuzzyllama Sep 08 '11 at 13:50

3 Answers3

1

You can try backtrace, but its hard to implament. And some information here.

Community
  • 1
  • 1
Ernestas Stankevičius
  • 2,420
  • 2
  • 24
  • 30
0

There is a way for protected & private methods, however AFAIK none to log public method calls.

cypher
  • 6,822
  • 4
  • 31
  • 48
  • You can simply wrap the objects in question into a Decorator that has only the __call method. This way, you can intercept all methods on the decorated instance. – Gordon Sep 08 '11 at 13:42
0

Why would you want to do that?

If you want to see the execution plan you can :

  1. run a xdebug profiling
  2. run your application in a debugger

If it's for something else, don't do it. It will only make your code harder to read and fill your HDs with useless data that you can have whenever you want using points 1) ou 2) described above.

Edit : my company does exactly what you want and I assure you you don't want to get there.

Alfwed
  • 3,307
  • 2
  • 18
  • 20