Using PHPStorm 6/7 (or WebStorm I guess), is it possible to configure a debug session so that it understands and uses piping to have a more convenient display in the PHPStorm console? I'm working on a nodejs app that utilizes bunyan. I'd like for PHPStorm to be able to pretty print the debug output as it would if I launched the app from the terminal.
Here's an example config:

But the command it's trying to run is:
/usr/local/bin/node --debug-brk=57073 app.js -vv 2>&1 "|" bunyan
If it wouldn't quote the pipe symbol, it might work, but I'm not sure.
Pipes is a feature of the command line shell, PhpStorm doesn't use shell to start your configuration, so pipes and output redirection will not work.
Slightly related issues:
You can probably hack some wrapper shell script around node and use it instead of the default node script. Your custom shell script can parse the arguments in its own way and perform piping. Not sure how well it will work.
I found a bit a hacky solution for this problem that I also encountered. My solution doesn't include any configuration change in WebStorm. I simply created a piped output that is parsed with bunyan CLI tool which is loaded through node spawn child_process.
The code looks like this :
bunyan = require('bunyan');
logOptions = { name: 'myApp' };
// Activate this logger only for development and leave the original for production
if ( process.env.NODE_ENV === 'development' ) {
spawn = require('child_process').spawn;
bunyanCLI = spawn('bunyan', ['--color'], { stdio: ['pipe', process.stdout] });
logOptions.stream = bunyanCLI.stdin;
}
log = bunyan.createLogger(logOptions);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With