Can I process/parse output (to make it look different?)

I'm using Intellij 14.1.5 (but would not mind to update if that fixes hings).

My project is using Node.JS and coffeescript. I have a corresponding Node.JS run configuration, which starts the application just fine. There is one downside: my application uses bunyan for logging. As a result, my output window is now full with highly structured, but quite unreadable log statements, like this:

/usr/bin/node index.js
{"name":"queue","hostname":"laptop-guus","pid":24735,"level":20,"msg":"[CONFIG] Current log level: DEBUG","time":"2015-12-03T09:59:28.868Z","v":0}
{"name":"queue","hostname":"laptop-guus","pid":24735,"level":20,"msg":"[DATASTORE] Connecting to require databases","time":"2015-12-03T09:59:32.601Z","v":0}
{"name":"queue","hostname":"laptop-guus","pid":24735,"level":30,"msg":"[SOCKET] Socket server started. Now accepting connections...","time":"2015-12-03T09:59:34.888Z","v":0}
{"name":"queue","hostname":"laptop-guus","pid":24735,"level":20,"msg":"[SOCKET] Setup Redis cluster adapter to 127.0.0.1:6379","time":"2015-12-03T09:59:34.891Z","v":0}
{"name":"queue","hostname":"laptop-guus","pid":24735,"level":20,"msg":"[DATASTORE] All databases ready. Waking up the janitor","time":"2015-12-03T09:59:35.070Z","v":0}
{"name":"queue","hostname":"laptop-guus","pid":24735,"level":20,"msg":"[ELASTICSEARCH] Connecting to localhost:9200","time":"2015-12-03T09:59:32.601Z","v":0}
{"name":"queue","hostname":"laptop-guus","pid":24735,"level":20,"msg":"[COUCHDB] Connecting to localhost:5984","time":"2015-12-03T09:59:32.606Z","v":0}


(things get progressively worse when more complex log statements are being created)

If i'd start Node from the commandline, I'd simply pipe the bunyan executable:

$ /usr/bin/node | /usr/bin/bunyan

That would give me something like this:

[2015-12-03T09:59:28.868Z] DEBUG: queue/24735 on laptop-guus: [CONFIG] Current log level: DEBUG
[2015-12-03T09:59:32.601Z] DEBUG: queue/24735 on laptop-guus: [DATASTORE] Connecting to require databases
[2015-12-03T09:59:34.888Z]  INFO: queue/24735 on laptop-guus: [SOCKET] Socket server started. Now accepting connections...
[2015-12-03T09:59:34.891Z] DEBUG: queue/24735 on laptop-guus: [SOCKET] Setup Redis cluster adapter to 127.0.0.1:6379
[2015-12-03T09:59:35.070Z] DEBUG: queue/24735 on laptop-guus: [DATASTORE] All databases ready. Waking up the janitor
[2015-12-03T09:59:32.601Z] DEBUG: queue/24735 on laptop-guus: [ELASTICSEARCH] Connecting to localhost:9200
[2015-12-03T09:59:32.606Z] DEBUG: queue/24735 on laptop-guus: [COUCHDB] Connecting to localhost:5984


Somehow, I'd like Intellij to parse the output of node using bunyan. Any thoughts on how to do this? I've been playing with the run configuration, but it dislikes the | character...

2 comments
Comment actions Permalink

Hmm, the WYSIWYG editor of this community drops some of the coloring that bunyan applies. Trust me, the output is even prettier than what is shown above. :)

0
Comment actions Permalink

You can create a shell script that would pipe the output and then specify it as node interpreter. See comments inhttps://youtrack.jetbrains.com/issue/WEB-11774

0

Please sign in to leave a comment.