tempire / mojolicious-plugin-consolelogger

Show Mojolicious log messages in browser console (firebug, webkit dev tools)
8 stars 5 forks source link

Fun with preserved logs #1

Closed spacebat closed 12 years ago

spacebat commented 12 years ago

Hi, here's the patch as mentioned today on IRC. I've added a test, and another commit that throws a if (window.console) {} guard around the javascript - because a javascript exception can prevent other javascript from running, and if firebug isn't enabled, you get an exception.

I'm not precious with this code at all, use what thou wilt.

Cheers, Andy

tempire commented 12 years ago

I decided to make the clearing of logs on each request default behavior; it's more simple that way. Added name credit to log.

spacebat commented 12 years ago

I agree the after_dispatch hook is the place to do it, much simpler to do a splice right there.

You'll also want to remove the POD section I added about the clear_console_log helper.

Cheers!