Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to output debug statements to console in Visual Studio Code

How do I write to console from a .js method?

console.log is not showing anything in Console tab in Visual Studio Code

Here is an example of my method

_onPressItem = (index) => {
    console.log("Property Finder >> Pressed row: "+index);
};

This is triggered when I press on an item in my ListView. If I run this through XCode, I will see console.log line above printed in XCode. But if I debug it in VSCode, I see no console.log line being printed at all.

My Steps: 1. Open my project in VSCode My VS Code has installed react-native tools already

  1. Cmd+P then type command Debug: Start Debuging (it is an available command, I just select it)

  2. My App starts, DEBUG CONSOLE tab shows some lines but no line from my console.log command is shown

like image 662
pixel Avatar asked Aug 20 '17 17:08

pixel


1 Answers

I added:

"outputCapture": "std"

to my debug launch configuration and console.log statements work in the "DEBUG CONSOLE" tab.

Alternatively:

"console": "integratedTerminal" 

shows console.log in the "TERMINAL" tab.

like image 192
RationalDev likes GoFundMonica Avatar answered Nov 14 '22 23:11

RationalDev likes GoFundMonica