Skip to content

Instantly share code, notes, and snippets.

@bgausden
Created January 27, 2021 07:51
Show Gist options
  • Save bgausden/ea3938a63ac6fed8178282045fa79992 to your computer and use it in GitHub Desktop.
Save bgausden/ea3938a63ac6fed8178282045fa79992 to your computer and use it in GitHub Desktop.
VS Code Debug Console & NPM Debug package
In your script code add the following line. This sends the debug ouput via the console (where the vscode debug console will capture it):
debug.log = console.info.bind(console)
In launch.json add the following to your launch config to set the DEBUG envvar:
"env": {"DEBUG": "*,-getClients",
"DEBUG_COLORS": "true"}
for context the entire file looks like this:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}/dist/index.js",
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"env": {"DEBUG": "*,-getClients",
"DEBUG_COLORS": "true"}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment