Add a way to get the log line number when console.log has been wrapped by a custom function
See original GitHub issueIs 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 wraps console.log
. Now whenever it outputs to the debug console, the line number shows the code within my ConsoleTransport
class. I added the file to skipFiles
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.
// my launch.json configuration
{
"name": "Run Backend",
"type": "node",
"request": "launch",
"runtimeArgs": ["--nolazy", "-r", "ts-node/register", "-r", "tsconfig-paths/register"],
"args": ["./src/index.ts", "--transpile-only"],
"cwd": "${workspaceFolder}/backend",
"internalConsoleOptions": "openOnSessionStart",
"skipFiles": [
"<node_internals>/**",
"node_modules/**",
"${workspaceFolder}/backend/src/modules/logger/ConsoleTransport.ts"
],
"env": {
// ommitted
}
}
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.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:13 (6 by maintainers)
Top GitHub Comments
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)
sure thing, thanks for filing the issue and verifying 😃