Remove clutter from logger (#196)

* Remove clutter from the logger

Prior to this commit the logger was stringfying even functions.
Because of this response errors from axios was dumping a log of info on
the logs.

* Fixing standard style issues

* Check for toString on meta
This commit is contained in:
Rafael Taranto 2018-10-30 03:48:16 -03:00 committed by Josh Harvey
parent b47af59a7f
commit de8a380bd8

View file

@ -1,10 +1,15 @@
const winston = require('winston') const winston = require('winston')
const options = require('./options') const options = require('./options')
const _ = require('lodash')
const logger = new winston.Logger({ const logger = new winston.Logger({
level: options.logLevel, level: options.logLevel,
transports: [ transports: [
new (winston.transports.Console)({timestamp: true, colorize: true}) new (winston.transports.Console)({ timestamp: true, colorize: true })
],
rewriters: [
(...[,, meta]) => _.hasIn('toString', meta)
? meta.toString() : 'Error, no further information is available'
] ]
}) })