Closed jkav77 closed 6 years ago
This looks like a string that's been augmented with level
and message
attributes. From where are you obtaining these messages?
I just use Winston and add it to the Dynogels config as described in the documentation. I see the above output in AWS CloudWatch logs.
const winston = require('winston')
const logger = winston.createLogger()
const dynogels = require('dynogels')
dynogels.AWS.config.update({ region: 'us-east-1' })
dynogels.log = logger
The offending code is from table.js line 71:
self.log.info({ data: data }, 'dynogels %s response - %sms', method.toUpperCase(), elapsed);
This isn't really the right syntax for Winston. I think it should be:
self.log.info({
message: `Dynogels ${method.toUpperCase()} response - ${elapsed}ms`,
data: data
})
The above log calls expect the output to be parsed with util.format
which winston
does not do by default. You can create a custom format for winston
to make it use util.format
but it is substantially different from what is described in the documentation. I think bunyan
does this by default. I will test that out later...
I have played around with this a bit and couldn't get Winston working. I switched to Bunyan and it worked out of the box. Has anyone used Winston with dynogels successfully?
I feel like I have seen someone bring this up before but I couldn't find it in a search.
I'm using Winston for a logger, and the format of the logs is suboptimal. I'm not sure if it's just me or if this is what others are seeing too. If anyone else is interested I will do a pull request to fix it.
The log format I am seeing in AWS CloudWatch: