You could add the following to the if clause:
if (console && console.log) {
console.log('removing child');
}
Or write a log wrapper around the console.log function like this.
window.log = function () {
if (this.console && this.console.log) {
this.console.log(Array.prototype.slice.call(arguments));
}
}
Use it like this:
log("This method is bulletproof", window, arguments");
And here is a jsfiddle for this:
http://jsfiddle.net/joquery/4Ugvg/