title: Node logging with Winstonjs logger gives TypeError
body: <p>I'm just started out with Node and I now want to add some logging to my application, for which <a href="https://github.com/winstonjs/winston" rel="nofollow noreferrer">Winstonjs</a> seems a perfect fit. So I first installed it:</p>
  
  <pre><code>npm install winston
  </code></pre>
  
  <p>And then I copied the first example code from the readme (and added the require before it):</p>
  
  <pre><code>"use strict";
  
  let winston = require('winston');
  
  const logger = winston.createLogger({
    level: 'info',
    format: winston.format.json(),
    transports: [
      //
      // - Write to all logs with level `info` and below to `combined.log` 
      // - Write all logs error (and below) to `error.log`.
      //
      new winston.transports.File({ filename: 'error.log', level: 'error' }),
      new winston.transports.File({ filename: 'combined.log' })
    ]
  });
  
  //
  // If we're not in production then log to the `console` with the format:
  // `${info.level}: ${info.message} JSON.stringify({ ...rest }) `
  // 
  if (process.env.NODE_ENV !== 'production') {
    logger.add(new winston.transports.Console({
      format: winston.format.simple()
    }));
  }
  </code></pre>
  
  <p>But I get an error:</p>
  
  <pre><code>/Users/kramer65/mms/testlogging.js:7
      format: winston.format.json(),
                            ^
  TypeError: Cannot read property 'json' of undefined
  </code></pre>
  
  <p>Does anybody know what I'm doing wrong here? All tips are welcome!</p>