Soma Posted December 13, 2012 Share Posted December 13, 2012 Chrome Php LoggerModule to log useful details directly in your Chrome JS console. You can inspect most as objects and see infos or values.To enable logging with this module you have to enable debug modue in config.php. If debug is set to false in config.php, it will not output any log.Important: It is not recommended to enable it on live stage, as it reveal infos you might not want everybody to see, although it's not obvious as it requires the ChromePhp Extension installed and enabled.- render time- memory consumption- cpu usage- current user infos - current user roles - current user permissions- current page with all its fields and their value and field settings- page cache/loaded on request count- fuel- modules loaded- Server vars etc. - Cookies - Requests- mySQL query logWhen installed you can also use ChromePhp static methods to output your own data in all your templates or modules: ChromePhp::log($page->somefield); Note:This module requires the ChromePhp Extension installed to see the log in the Javascript console.More infos can be found on http://chromephp.comDownload: Modules Directory: http://modules.processwire.com/modules/chrome-php-logger/Github: https://github.com/s...ChromePhpLogger 12 Link to comment Share on other sites More sharing options...
teppo Posted December 13, 2012 Share Posted December 13, 2012 First of all, Soma, this looks VERY nice! Will install it right now One thing that might be worth mentioning is that since Windows doesn't have getrusage() implemented (correct me if I'm wrong) this might cause some problems in Win-environment. Might be worth checking if it's available first and possibly even providing an alternative solution? 1 Link to comment Share on other sites More sharing options...
nik Posted December 13, 2012 Share Posted December 13, 2012 Good job Soma! I like the way you're thinking - I had a module with just slightly less functionality coming up, this week even . But now I don't need to find time to finish it as you've already done things bigger and better. One thing I'd like to see is a little if-statement to disable this when $this->config->debug is false. That would prevent internal structures being displayed at production stage if (when!) debug-mode has been properly disabled. 2 Link to comment Share on other sites More sharing options...
Adam Kiss Posted December 13, 2012 Share Posted December 13, 2012 On 12/13/2012 at 6:57 AM, nik said: One thing I'd like to see is a little if-statement to disable this when $this->config->debug is false. That would prevent internal structures being displayed at production stage if (when!) debug-mode has been properly disabled. +1 for this; and I as well wanted to package ChromePHP into a module... You beat me to it, will install this ASAP 1 Link to comment Share on other sites More sharing options...
diogo Posted December 13, 2012 Share Posted December 13, 2012 Good one soma! Quote One thing I'd like to see is a little if-statement to disable this when $this->config->debug is false I think it would be enough to have it enabled only for logged in superusers. 1 Link to comment Share on other sites More sharing options...
Soma Posted December 13, 2012 Author Share Posted December 13, 2012 Thanks guys. Yes definately want to implement some of those. Yes the CPU test doesn't work on Windows. I don't have windows host so I couldn't test, but will implement a check definately. Would be helpful if someone has/knows a script for Windose. I wasn't sure about superuser only. Because if you want to test not Logged in or with another user... I will add the config true test. Sorry guys to get it done before you. We need some board to check in if somebody starts on a module so people can check and see if already something is in work. Although this took me 1 evening lol. Link to comment Share on other sites More sharing options...
Soma Posted December 13, 2012 Author Share Posted December 13, 2012 Just pushed an update to support config true, and added check for getrusage support. To enable logging with this module you have to enable debug modues in config.php. If debug is set to false in config.php, it will not output any log. Important: It is not recommended to enable it on live stage, as it reveal infos you might not want everybody to see, although it's not obvious as requires the ChromePhp Extension installed and enabled. 1 Link to comment Share on other sites More sharing options...
nik Posted December 13, 2012 Share Posted December 13, 2012 On 12/13/2012 at 10:55 AM, Soma said: I wasn't sure about superuser only. Because if you want to test not Logged in or with another user... I will add the config true test. This is what I was thinking too. And the database queries are not logged if debug=false as well. I see you've decided not to output anything in the admin.. I guess that's because most of the data already is visible there? And while the module adds no hooks in the admin, it does make ChromePhp available for use - so nevermind, just thinking aloud here . Quote Sorry guys to get it done before you. We need some board to check in if somebody starts on a module so people can check and see if already something is in work. Although this took me 1 evening lol. With small modules like this one there shouldn't be a problem. I think I even managed to learn something from the few hours I spent with this one. About PW itself and that I tend to overcomplicate things (had a couple of unnecessary config vars and a little abstraction layer to support other plugins as well later on). Sometimes (well, most of the time) it would be better to get something released and then keep on making it better - if there really is any need after all. I'm trying to keep this in mind: "If you’re not embarrassed when you ship your first version you waited too long." (see ma.tt/2010/11/one-point-oh/ for the whole essay). A rule not to be followed by people implementing safety measures to nuclear power plants though. But if I was to start building something bigger, it would be nice to know if someone else is already working on the same thing. That would of course be useful to us mere mortals with somewhat smaller modules too. Not all of us are able to get these kind of useful things from scratch to release during one evening like you are Soma . 1 Link to comment Share on other sites More sharing options...
DaveP Posted December 13, 2012 Share Posted December 13, 2012 Oops, big fat ugly 500 server error. Trouble is, it's shared hosting, so I don't have access to error logs. (Works alright on Win 7 development system, though.) Link to comment Share on other sites More sharing options...
Martijn Geerts Posted December 13, 2012 Share Posted December 13, 2012 Nice one-liner Nik: "If you’re not embarrassed when you ship your first version you waited too long." Link to comment Share on other sites More sharing options...
thomas Posted December 13, 2012 Share Posted December 13, 2012 Thanks Soma, this is great! Link to comment Share on other sites More sharing options...
Soma Posted December 13, 2012 Author Share Posted December 13, 2012 On 12/13/2012 at 3:07 PM, DaveP said: Oops, big fat ugly 500 server error. Trouble is, it's shared hosting, so I don't have access to error logs. (Works alright on Win 7 development system, though.) Since when? Works fine here and have no clue what causes the error on your side. Link to comment Share on other sites More sharing options...
DaveP Posted December 13, 2012 Share Posted December 13, 2012 @Soma, me neither. Just installed on remote server and it didn't like it. Will try to troubleshoot some more tomorrow. Link to comment Share on other sites More sharing options...
Soma Posted December 13, 2012 Author Share Posted December 13, 2012 Just pushed an update. update to version 0.0.3, some improvements and refactoring - Improved a lot on some page/user fields parsing to give better and deeper results with page fields and file fields. Also shows now fields that are empty and writes "null" in the log. - Fixed issue with some in admin request getting logged still. On 12/13/2012 at 5:04 PM, DaveP said: @Soma, me neither. Just installed on remote server and it didn't like it. Will try to troubleshoot some more tomorrow. I can image something with getrusage() on your hosting having a problem? Not sure though what else. 1 Link to comment Share on other sites More sharing options...
ryan Posted December 17, 2012 Share Posted December 17, 2012 This is great Soma! Testing out here and seems to work beautifully. Please add it to the modules directory when you get a chance. 1 Link to comment Share on other sites More sharing options...
Soma Posted April 15, 2013 Author Share Posted April 15, 2013 Just added this module to the modules directory. http://modules.processwire.com/modules/chrome-php-logger/ 3 Link to comment Share on other sites More sharing options...
adrian Posted April 15, 2013 Share Posted April 15, 2013 Hey Soma, Just went to install via the modules manager and got this notice (obviously not a big deal, but nice to fix): Notice: Undefined variable: success in /site/modules/ModulesManager/ModulesManager.module on line 393 BUT the following is a show stopper: ModulesManager: File could not be downloaded https://github.com/somatonic/ChromePhpLogger/archive/master There seems to be a problem with downloading or writing the module. Link to comment Share on other sites More sharing options...
Soma Posted April 15, 2013 Author Share Posted April 15, 2013 Thanks adrian for the report, turns out the download github link as wrong. Should be fixed now. Link to comment Share on other sites More sharing options...
diogo Posted April 26, 2013 Share Posted April 26, 2013 Just to say that ChromePHP is now called Chrome Logger and lives on this url http://www.chromelogger.com 1 Link to comment Share on other sites More sharing options...
Jonathan Dart Posted September 30, 2013 Share Posted September 30, 2013 Hi Soma, This thing is sweet and adds a lot for my needs. It's giving me an error when caching is enabled on a page. I get the below error: Notice: Trying to get property of non-object in /app/www/sites/delucas/site/modules/ChromePhpLogger/ChromePhpLogger.module on line 223 Fatal error: Call to a member function getIterator() on a non-object in /app/www/sites/delucas/site/modules/ChromePhpLogger/ChromePhpLogger.module on line 223 Link to comment Share on other sites More sharing options...
Soma Posted October 1, 2013 Author Share Posted October 1, 2013 Thanks jonathan, I will add a check to exit on cached pages. Haven't tested so far with cache on, and if logged in there's no cache. Also I thought ChromePhpLogger only executes when logged in anyway so I'm a bit stumped. Edit: But remember now that I let it on to test with guest or other users. But with cached pages there's no things to debug/log Link to comment Share on other sites More sharing options...
Soma Posted October 1, 2013 Author Share Posted October 1, 2013 Ehrm.. I'm looking into this closer and now reading again your post, it's not an error but a only a notice. Further it's in a strange place where it cycles files/images field and I can't reproduce this and can't think of anything atm. Also it seems I get tricked by my own modules an PW. This actually works with cached pages?? Which means even if the page is cached and I'm not logged in it shows the details. Long time since I wrote the module but I think it's simply that the module loads the infos to output as PW even with cache on needs to know what page it's loading". Funny. I would have thought it wouldn't work with cache. Well then with ProCache it wouldn't work. Link to comment Share on other sites More sharing options...
Soma Posted October 1, 2013 Author Share Posted October 1, 2013 I added a check at that place for and you might want to get the following module file and let me know if it's gone. But as said I don't understand, that when it gets that far there's should be a object. Can you tell what file or image field there is where it throws the notice, maybe I understand little more. But nothing dramatic. ChromePhpLogger.moduleFetching info... 1 Link to comment Share on other sites More sharing options...
Jonathan Dart Posted January 6, 2014 Share Posted January 6, 2014 Hi Soma, I was trying to use this with a pw2.4, and had to change line 180 of the module class to "foreach($this->database->getQueryLog() as $n => $sql) {" to get it working for query debugging. Just a heads up. 1 Link to comment Share on other sites More sharing options...
Soma Posted January 7, 2014 Author Share Posted January 7, 2014 Thanks Jonathan, $database is the new PDO, while $db is the mysqli. If I change it, it won't work in older PW versions. Maybe I could just add both with a check. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now