winston-cloudwatch
winston-cloudwatch copied to clipboard
multi line log support?
hi! i'm using winston-cloudwatch.
i try multi lline log transport.
ex.
[2017-04-26T04:36:44.876Z] POST 200 /api/v1/order/route HTTP/1.1 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36 [time 2132.164 ms]
"Request-Body" : {
"point_coordinates": [
{
"lat": "37.52378691842046",
"lon": "127.04685658762004"
},
{
"lat": "37.4952615945518",
"lon": "127.045626516174"
},
{
"lat": "37.4641697457126",
"lon": "127.102753896677"
}
]
}
but cloudWatch log.
info - ::ffff:127.0.0.1 - - [26/Apr/2017:02:28:58 +0000] "POST /api/v1/order/route HTTP/1.1" 200 6614 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36"
why not add newline text?
thank you.
This problem solved.
i'm using morgan npm.
before code
winston.stream = {
write: (message, encoding) => {
winston.info(message)
}
}
app.use(morgan('combine', {
'stream': logger.stream
}))
after code
winston.stream = {
write: (message, encoding) => {
winston.info(message)
}
}
app.use(morgan('[:date[iso]] :method :status :url HTTP/:http-version :user-agent [time :response-time ms] :req-body', {
'stream': logger.stream
}))
But logger.info(resp) and logger.info('resp', resp) different result in cloudWatch console.
logger.info(resp) - cloudWatch not logged
{ '0':
...
}
logger.info('resp', resp) - cloudWatch logged
resp:
{ '0'
...
}
I'm not sure what you're saying sorry, should I close the issue @barogo-jwyoon?
my issue is not display at aws cloudWatch console with logger.info(resp).
but logger.info('resp', resp) display at aws cloudWatch.
resp = {
'0': 'test'
'1': 'test1'
}