Using node.js Bunyan Logging with Intellij
<p>I'm using bunyan logging for a node.js subsystem and typically use intellij IDEA. I would like to use <a href="http://trentm.com/node-bunyan/bunyan.1.html" rel="nofollow noreferrer">bunyan's pretty printer</a> so that I can get the benefits of buynan/json logs within intellij.</p>

<p>I cannot find any way to do this but feel it must be possible. Has anyone figured out how to do this?</p>

<p>UPDATE: </p>

<p><a href="https://stackoverflow.com/questions/36312986/using-node-js-bunyan-logging-with-intellij/38718203#38718203">@cyue's</a> answer below works like a champ. When I didn't find something right away I ended up creating something like this in a logging class that I use to wrap this functionality and use it for test servers:</p>

<pre><code>var bunyan = require('bunyan');
var bunyanFormat = require('bunyan-format');
var standardOut = bunyanFormat({outputMode: 'long', levelInString: true});
var errorOut = bunyanFormat({outputMode: 'bunyan', levelInString: true});
var bunyanLogger = bunyan.createLogger({
    name: 'tot',
    streams: [
        {
            stream: process.stdout ,
            level: 'trace'
        },
        {
            stream: process.stderr ,
            level: 'warn'
        }
    ],
    serializers: {
        req: bunyan.stdSerializers.req,
        res: bunyan.stdSerializers.res,
        err: bunyan.stdSerializers.err,
        error: bunyan.stdSerializers.err
    }
});
eventLogger.on('log', function (log) {
    if (resolveLevel(log.level) &gt;= minimumLogLevel) {
        bunyanLogger[log.level].apply(bunyanLogger, log.arguments);
    }
});
</code></pre>

<p>The above shouldn't be run in production code but thought it might be useful to some... </p>