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 I also can not get their names with callee.caller.name.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’m not sure about firefox, but in v8/chrome you can use a method on the Error constructor called
captureStackTrace. (More info here)So a hacky way to get it would be:
Normally,
getStackTracewould be on the stack when it’s captured. The second argument there excludesgetStackTracefrom being included in the stack trace.