From de8a380bd8039ec0c08282769f67ed26118b02b7 Mon Sep 17 00:00:00 2001 From: Rafael Taranto Date: Tue, 30 Oct 2018 03:48:16 -0300 Subject: [PATCH] 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 --- lib/logger.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/logger.js b/lib/logger.js index 8312b5e2..29556e81 100644 --- a/lib/logger.js +++ b/lib/logger.js @@ -1,10 +1,15 @@ const winston = require('winston') const options = require('./options') +const _ = require('lodash') const logger = new winston.Logger({ level: options.logLevel, 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' ] })