I want to override the console.log function in order to save the data other scripts log. My script executes before any other script, so I have full control over the environment. This is my current function for overwriting console.log:+function(){    var a = Function.prototype, b = 'toString', c = a[b], d = c.apply(c).split(c.name), e = [], f = [], g = function(a, b){        e.push(a);        f.push(b);        return a;    }, _ = [];    a[b] = function(h){        return g(function toString(){            var i = e.indexOf(this);            return i != -1 ? f[i] || d.join(this.name) : h.apply(this);        });    }(c);    console.log = function(a){        return g(function log(){            var b = [], i;            for(i in arguments) b.push(arguments[i]);                _.push(b.slice());            return a.apply(this, arguments);        });    }(console.log);}();My question is simple: is it possible that some script executed after this can reveal that I have an overwritten console.log function?I will use it for debugging scripts sent from users to my Node.js server application. I am using vm module, so I need to overwrite sandbox the object's console.log function in order to trace what users log to console in received scripts.If this code looks obfuscated, here is a better version.
Overwriting native console.log function in JavaScript
javascript;security;logging
At first sight, this is really clever, because inspecting console.log will still show log() { [native code] }But then, what is this property prototype that is not present in the original console.log? Even more interesting, in Chrome Canary, console.log.prototype.constructor will show the location of the implementation, which is clearly in user space:Object  constructor:log()    arguments:null    caller:null    length:0    name:log    prototype:Object    __proto__:()    [[FunctionLocation]]:VM1191:16    [[Scopes]]:Scopes[3]  __proto__:ObjectIn node.js, the constructor just behaves weirdly and is indicative of weird things going on.Furthermore, since this is codereview, the commonly accepted practice for immediately self executing is(function functionName(arguments){ })();That + is super hokey, and will be used in future codegolfing entries ;)