Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

console.log() replacement issues

Go to End

3 Posts   2192 Views


Administrator, 690 Posts

13 June 2007 at 11:18am

There appears to be code in protoype_improvements.js that provides a replacement console.log() in cases where you don't have firebug installed.

The problem is that this has a habit of popping up on production sites.

Who wrote this code? What's the best way of fixing this? Do we need a reliable way of calling Director::isDev() from within javascript, perhaps?


Forum Moderator, 801 Posts

13 June 2007 at 1:38pm

i've implemented the firebug-replacement.
you can use Debug.isTest() in javascript to limit console.log()-calls to non-live environments (has the same restrictions as Director::isLive(), just regexing the url for ".test" and ".dev"). you can override this behaviour with Debug.set_environment_type(). see

then again, console.log()-code should not be committed at all - it produces a javascript-error if the firebug-replacement is not existing.


Administrator, 690 Posts

13 June 2007 at 2:39pm

Alright, I've stitched these two up. If you're on a live site, then the console.log messages will be silently dropped.

I also fixed Debug.isLive() - it now calls !Debug.isDev()

Although you're right about getting rid of console.log messages after you've finished debugging, this will prevent ones that slip through from breaking sites.

Changeset here: