surion Posted October 1, 2008 Share Posted October 1, 2008 Hello, i was wondering if it is possible in a function to track from where it got called,... at the moment i have a function function mysql_log_query($file,$line,$sql){ // some stuf } called this way: mysql_log_query(__FILE__,__LINE__,$sql); it performs a mysql_query() for the given query ($sql) and if the query takes too long it makes a log for this, using __FILE__ & __LINE__ to determine from where it got called. now i was wondering, is it possible to do the same in that function without the use of __FILE__ and __LINE__? i ask this because it would make me program alot faster if i don't have to type that __FILE__,__LINE__ all the time. grz Link to comment https://forums.phpfreaks.com/topic/126584-solved-function-tracking/ Share on other sites More sharing options...
aschk Posted October 1, 2008 Share Posted October 1, 2008 debug_backtrace() <- the array version or debug_print_backtrace() <- the printed version If you call this at a point that you might expect a failure, or catch an exception it should give you the call stack that got you to where you are. Link to comment https://forums.phpfreaks.com/topic/126584-solved-function-tracking/#findComment-654579 Share on other sites More sharing options...
surion Posted October 1, 2008 Author Share Posted October 1, 2008 w000000t, this is exactly what i was looking for, thanks alot mate, you rock Link to comment https://forums.phpfreaks.com/topic/126584-solved-function-tracking/#findComment-654582 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.