0

is there a way to send the line and file a console function has been called?

i got an app with many console log and console error in it. thats a good thing for me, the problem is i need to know from where they came from.

i tried override console.error and add console.trace inside but that just created a recursive call to console error(i guess they both triggered by process strerr)

here is what i have tried

const tempConsoleError = console.error.bind(console);
console.error = function (err) {
    console.log('i am in error')
  
    tempConsoleError(err);
    
    console.trace()
};
console.error('error string ')
Amit Wagner
  • 3,134
  • 3
  • 19
  • 35

1 Answers1

0

ended up writing a packages to do it. is uses the "stack-trace" and node global

console-from

Amit Wagner
  • 3,134
  • 3
  • 19
  • 35