summaryrefslogtreecommitdiff
path: root/_posts/2011-02-20-psgichrome.textile
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2011-02-20 11:12:33 +0100
committerfranck cuny <franck@lumberjaph.net>2011-02-20 11:12:33 +0100
commit6b6a194618587c44c00a6af52515049b8bf566f9 (patch)
tree82c0b12a7e5251a7ec2be5b226cf0d97e9e9e7bd /_posts/2011-02-20-psgichrome.textile
parentround corner (diff)
downloadlumberjaph-6b6a194618587c44c00a6af52515049b8bf566f9.tar.gz
new post, and some fix to the CSS
Diffstat (limited to '_posts/2011-02-20-psgichrome.textile')
-rw-r--r--_posts/2011-02-20-psgichrome.textile44
1 files changed, 44 insertions, 0 deletions
diff --git a/_posts/2011-02-20-psgichrome.textile b/_posts/2011-02-20-psgichrome.textile
new file mode 100644
index 0000000..cdcd045
--- /dev/null
+++ b/_posts/2011-02-20-psgichrome.textile
@@ -0,0 +1,44 @@
+---
+layout: post
+category: perl
+title: PSGIChrome
+---
+
+Earlier this month, I've found this extension: "chromePHP":http://www.chromephp.com/.
+
+The principle of this extension is to allow you to log from your PHP application to crhome. 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!
+
+Let's mimic their page.
+
+h1. Installation
+
+# install plack (cpanminus Plack)
+# no step 2
+# no step 3
+# write a simple PSGI application and log
+
+<script
+src="https://gist.github.com/750108.js?file=chromeplack.pl"></script>
+
+Load this application with plackup:
+
+bc. plackup chromeplack.pl
+
+point your browser to *http://localhost:5000*, activate the javascript console (with chrome of firefox, this work with both).
+
+if this works correctly, you should have a smiliar output in your console:
+
+<a href="http://f.lumberjaph.net/blog/misc/plack_chrome.png"><img class="img_center" src="http://f.lumberjaph.net/blog/misc/plack_chrome.png" /></a>
+
+h2. Dancer
+
+I don't know for other framework, but you can also log to your browser with "Dancer":http://perldancer.org/.
+
+In your application, you need to edit the environment file. You'll certainly want to change 'development.yml'.
+
+bc.. logger: "PSGI"
+plack_middlewares:
+ -
+ - ConsoleLogger
+
+p. Now you can start your application (running in Plack environment, of course), and next time you'll use 'warning' or 'debug' or any other keyword from Dancer::Logger, the message will end up in your javascript console.