console.trace()
outputs its result on console.
I want to get the results as string and save them to a file.
I don\'t define names for functions and
Error.stack is what you need. It works in Chrome and Firefox. For example
try { var a = {}; a.debug(); } catch(ex) {console.log(ex.stack)}
will give in Chrome:
TypeError: Object #
and in Firefox:
@http://www.google.com.ua/:87 _firebugInjectedEvaluate("with(_FirebugCommandLine){try { var a = {}; a.debug() } catch(ex) {console.log(ex.stack)}\n};")
@http://www.google.com.ua/:87 _firebugEvalEvent([object Event])
@http://www.google.com.ua/:67