Have ideas to improve npm?Join in the discussion! »

@abbit/bunyan-cloud-function
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

bunyan-cloud-function

A package that allows you to use Bunyan on Google Cloud Functions, have your logs appear on StackDriver, and not have to deal with missing logs, async log saving, delayed logs due to function freeze after return, etc, etc, etc.

Install

npm i --save @abbit/bunyan-cloud-function

Usage

import bunyan from 'bunyan';
import {LoggingBunyan} from '@abbit/bunyan-cloud-function';

const loggingBunyan = new LoggingBunyan();

const logger = bunyan.createLogger({
    name: 'test',
    streams: [
        loggingBunyan.stream('INFO') // Will log to stdout in a format that stackdriver understands
    ],
});

Tech stuff

This package changes the json format written to stdout(yes, stdout) just enough so that StackDriver recognizes the messages and log levels.

We created this because we like Bunyan and all other solutions were a pain to use. The file is 100 lines long so if it's not quite right for you feel free to play around and submit a pull request.

Install

npm i @abbit/bunyan-cloud-function

DownloadsWeekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

8.37 kB

Total Files

6

Last publish

Collaborators

  • avatar