1.0.0 • Published 6 years ago

@soliveira/bunyan-lambda-stream v1.0.0

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

bunyan-lambda-stream

Writes bunyan logs using console for easier reading from CloudWatch

Install

npm i @soliveira/bunyan-lambda-stream

Usage

const bunyan = require('bunyan')
const lambdaStream = require('@soliveira/bunyan-lambda-stream')
const log = bunyan.createLogger({
  name: 'foo',
  streams: [{
      stream: lambdaStream(),
      type: 'raw'
    }]
})

In cloudwatch a log record should now look like the following:

2018-10-01T20:29:15.951Z a9ae59ca-c5b8-11e8-93b1-15c8516d5d59
{
  "name": "bunyan-lambda-stream",
  "hostname": "admins-MacBook-Pro-2.local",
  "pid": 56822,
  "level": 30,
  "msg": "test",
  "time": "2018-10-01T21:19:21.423Z",
  "v": 0
}

Note that the cloudwatch record timestamp and requestId are preserved