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:
parent
b47af59a7f
commit
de8a380bd8
1 changed files with 6 additions and 1 deletions
|
|
@ -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'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue