By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,831 Members | 2,237 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,831 IT Pros & Developers. It's quick & easy.

How to find what called a function

P: n/a
I am making a logger class in my application, i want to put a display
the source which called the logging method. How can i do this?

say if i call Logger->debug("Test Message") then the Logger can
display DEBUG:SOURCE of CALL:Test Message

Aug 25 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

bibstha <bi***********@gmail.com>
on Sunday 24 August 2008 21:55
wrote in comp.lang.php:

I am making a logger class in my application, i want to put a display
the source which called the logging method. How can i do this?

say if i call Logger->debug("Test Message") then the Logger can
display DEBUG:SOURCE of CALL:Test Message
Try the debug_backtrace() or debug_print_backtrace() functions,
read the documentation of both at:
http://www.php.net/manual/en/functio...-backtrace.php

This would help a bit...

Regards,
- --
.O. | Daniel Molina Wegener | C/C++ Developer
..O | dmw [at] coder [dot] cl | FOSS Coding Adict
OOO | http://coder.cl/ | Standards Rocks!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (FreeBSD)

iEYEARECAAYFAkiyK94ACgkQxyPEFPXO3WGJsQCfbYA1QMKCnm 8KT75PhQGVAyO1
EowAn0GpcmPf2LnzowoZb08tIYnW9U7P
=HmC0
-----END PGP SIGNATURE-----
Aug 25 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.