modifies console log to capture values
var text = {body:""};
//capturing of console log strings for eval execution
//good for text area shit
function consoletest(code){
var oldLog = console.log;
console.log = function (message) {
text.body += "\n" + message;
oldLog.apply(console, arguments);
};
var result = eval(code);
return result;
}
/*=> undefined
consoletest("console.log(4)")
4
=> undefined
text
=> { body: '\n4' }
consoletest("console.log('hello sir')")
hello sir
=> undefined
text
=> { body: '\n4\nhello sir\nhello sir' }
console.log(text.body)
4
hello sir
hello sir
=> undefined
text
=> { body: '\n4\nhello sir\nhello sir\n\n4\nhello sir\nhello sir\n\n4\nhello sir\nhello sir' }*/