Earlier this month, I’ve read about this extension: chromePHP.
The principle of this extension is to allow you to log from your PHP application to chrome. You may not be aware, but this is something you already have with every web application if you’re using Plack. And not only for Chrome, but every webkit navigator, and Firefox too!
Let’s mimic their page.
- install Plack::Middleware::ConsoleLogger (cpanm Plack::Middleware::ConsoleLogger)
- no step 2
- no step 3
- write a simple PSGI application and log
Load this application with plackup:
if this works correctly, you should have a smiliar output in your console:
I don’t know for other framework, but you can also log to your browser with Dancer.
First, you need to install Dancer::Logger::PSGI, then, in your application, you need to edit the environment file. You’ll certainly want to change ‘development.yml’.
logger: "PSGI" plack_middlewares: - - ConsoleLogger