Add a way to get the log line number when console.log has been wrapped by a custom function #882
Description
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 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.
Activity