@soliveira/bunyan-lambda-stream

1.0.0 • Public • Published

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

Package Sidebar

Install

npm i @soliveira/bunyan-lambda-stream

Weekly Downloads

1

Version

1.0.0

License

ISC

Unpacked Size

3.51 kB

Total Files

5

Last publish

Collaborators

  • soliveira