import winston, { format } from 'winston';

function formatter(info) {
  const stringifiedRest = JSON.stringify(Object.assign({}, info, {
    level: undefined,
    message: undefined,
    splat: undefined
  }));

  const padding = (info.padding && info.padding[info.level]) || '';
  if (stringifiedRest !== '{}') {
    return `${info.timestamp} ${info.level}:${padding} ${info.message} ${stringifiedRest}`;
  }

  return `${info.timestamp} ${info.level}:${padding} ${info.message}`;
}

const logger = winston.createLogger({
  transports: [new winston.transports.Console()],
  level: process.env.NODE_ENV === 'development' ? 'debug' : 'info',
  format: format.combine(
    format.colorize(),
    format.timestamp(),
    format.printf(formatter)
  )
});

export default logger;

@@ -35,16 +35,48 @@
 inston';
+%0Aimport %7B inspect %7D from 'util';
 %0A%0Afuncti
@@ -126,23 +126,21 @@
 t = 
-JSON.stringify(
+inspect(%0A    
 Obje
@@ -165,16 +165,18 @@
 , %7B%0A    
+  
 level: u
@@ -181,24 +181,26 @@
  undefined,%0A
+  
     message:
@@ -207,24 +207,26 @@
  undefined,%0A
+  
     splat: u
@@ -236,18 +236,44 @@
 fined%0A  
-%7D)
+  %7D),%0A    %7B depth: null %7D%0A  
 );%0A%0A  co

use util.inspect for logger instead of json.stringify (#453)