I’m making a foray into php (wordpress) and have set up ChromeLogger (http://craig.is/writing/chrome-logger) and ChromePHP (https://github.com/ccampbell/chromephp).
I can now log ok from my templates, but i’d really like to be able to log to the console from inside php functions too (like in js), which is very useful for debugging. In this case my function is in
mywordpressfolder/wp-content/themes/mytheme/functions.php
Like i say i’m new to php and am not sure how it all fits together with the browser and whether this is possible. Is it? If so, how?
thanks, max
I realised that i don’t need to see debug output in the browser console, particularly, (ie i just need to see it) and that displaying it to the browser console might be impossible anyway in this case. So i wrote a helper function which writes out the filename and line number of the caller, along with a passed string argument.
I believe the standard php logging location is /var/tmp but i’m just writing into /tmp here. Produces output like this: