http://stackoverflow.com/questions/13815640/a-proper-wrapper-for-console-log-with-correct-line-number


<script>

var Log = Error;

Log.prototype.write = function () {

    var args = Array.prototype.slice.call(arguments, 0),

        suffix = this.lineNumber ? 'line: '  + this.lineNumber : 'stack: ' + this.stack;


    console.log.apply(console, args.concat([suffix]));

};


var a = Log().write('monkey' + 1, 'test: ' + 2);


var b = Log().write('hello' + 3, 'test: ' + 4);


</script>