Socket
Book a DemoInstallSign in
Socket

bunyan-buddy

Package Overview
Dependencies
Maintainers
6
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bunyan-buddy

Reduce the amount of Bunyan boilerplate code required, ideal when working with microservices.

1.6.0
latest
Source
npmnpm
Version published
Weekly downloads
1
-85.71%
Maintainers
6
Weekly downloads
 
Created
Source

bunyan-buddy

Version Downloads

Reduce the amount of Bunyan boilerplate code required with integration for Google Cloud Logging, ideal when working with microservices.

bunyan-buddy sets up a local stream using bunyan-prettystream (https://github.com/MaximusHaximus/node-bunyan-prettystrea) and a remote stream using @google-cloud/logging-bunyan. You can set the log levels for each using environment variables or as options when initializing it. For testing Google Cloud Logging locally, you can manually auth with it using a service account file.

Usage

const log = require('bunyan-buddy')(
    app: {
      name: 'my-app-name',      // defaults to 'app'
      version: '1.0.0',         // defaults to undefined
    },
    local_level: 'debug',       // defaults to process.env.LOG_LEVEL_LOCAL or 'info'
    remote_level: 'info',       // defaults to process.env.LOG_LEVEL_REMOTE or not set

    // optionally auth with google cloud logging
    // defaults to not set (auth is automatic if hosted on Google Cloud Platform)
    remote_auth: {
        projectId: 'my-google-cloud-project',
        keyFilename: '/path/to/gcloud-auth.json',
    },
});

log.info('This is logged locally and to Google Cloud Logging!');

log.debug('This is only logged locally (with the above options)');

log.error('This will log an error locally and on Google Cloud Logging, but not Google Cloud Error Reporting');

log.error(new Error('This will log in Google Cloud Error Reporting only if hosted on Google Cloud Platform'));

Keywords

bunyan

FAQs

Package last updated on 24 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.