node-source-map-support icon indicating copy to clipboard operation
node-source-map-support copied to clipboard

Supporting console statements with proper line numbers

Open GeeWee opened this issue 8 years ago • 4 comments

This is a wonderful little project, and we use it over at ts-jest - it would be wonderful to not only get correct line numbers in stacktraces, but also in console.log statements, to allow for print-debugging.

Are there any chances this project could grow to support something like that?

GeeWee avatar Aug 01 '17 14:08 GeeWee

I'm not entirely sure on what the problem is, console.log doesn't do anything with the line number as far as I'm aware?

LinusU avatar Aug 01 '17 14:08 LinusU

When printing things, usually chrome (or in my specific case, Jest) shows the line number where it was printed from - I'm not sure if it's patchable, or an issue I need to go to the jest repo with.

GeeWee avatar Aug 02 '17 06:08 GeeWee

~~This would be a great feature! In my case, I use console.dir to print Errors, for example:~~

try {
  throw new Error();
} catch (e) {
  console.error("Error occurred! Details:");
  console.dir(e);
}

myrdd avatar Sep 21 '17 05:09 myrdd

Oops, I misconfigured my sourcemap generator. What I asked for actually works.

myrdd avatar Sep 21 '17 05:09 myrdd