-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a way to get the log line number when console.log has been wrapped by a custom function #882
Comments
Can you share more details around the logger you use, or a small example repo? I'm not totally clear what the output or output structure are. Stack traces come in different shapes and sizes over the debug protocol. |
I'm actually using the winston logger, but a custom console transport because theirs doesn't work with the debug console. I got it working with the debug console but now the line numbers all show my custom Console transport class. |
Can you share the custom transport? |
I can do that in about an hour as I'm away from my desk, but it's literally their transport but with the console._stdout lines removed (and the of statements around them so it calls console.log) |
And the abridged code from another file to configure it with winston and export a logger:
And of course I use it in various places to like `mylogger.log('message here', meta); and it looks like this in the debugger
|
Thanks, I see what you mean. I think your intuition to use skipFiles is the right approach. I've updated the debugger so that the location shown in log messages will be the first location that isn't matched by the |
Amazing! Thanks so much for the quick work, I look forward to using it. |
Just gave Insiders 1.53.0 a try and I'm still getting the skipped file line number. Pretty much the same setup as discussed above. I'm not sure what to do to debug it on my end. Feel free to send me a DM if you want to do a quick video/screen share to work it out. Otherwise let me know how I can be of help to debug this. |
Insiders doesn't use the nightly release -- you'll want to install the nightly js-debug build manually. |
Ah got it. Would help if I read the readme, I apologize. So now I have it running and I get line numbers within a node_module like |
I think you want |
Ah, yes. That does the trick. Also I was hitting restart on the debug session which apparently uses the same cached launch config. It is working as expected with the glob pattern you just gave. Thanks a ton! |
sure thing, thanks for filing the issue and verifying :) |
Is your feature request related to a problem? Please describe.
I am working on a TS express app and the logger will use a custom
ConsoleTransport
class that wrapsconsole.log
. Now whenever it outputs to the debug console, the line number shows the code within myConsoleTransport
class. I added the file toskipFiles
of the launch config with the hope that it would ignore that file and perhaps show me the top call in the stack that was not ignored, but it did not.All the suggestions online show hacky or confusing ways of binding to console.log and/or overriding it which just feels wrong and unintuitive to me.
Describe the feature you'd like
I would love for it to use the first part of the stack that is not included in the
skipFiles
array or some way to tell the debugger to not use the strict line it called console.log but instead some custom function.The text was updated successfully, but these errors were encountered: