Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@probot/pino

Package Overview
Dependencies
Maintainers
7
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@probot/pino

formats pino logs and sends errors to Sentry

  • 2.3.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
40K
increased by26.72%
Maintainers
7
Weekly downloads
 
Created
Source

@probot/pino

formats pino logs and sends errors to Sentry

About

@probot/pino is currently built into probot, you don't need to manually pipe probot's logs into it. It will be easy to move it out of probot in future though, and give people a simple way to recover the logging behavior if they wish, or to replace it with another pino transport

CLI Usage

node my-script.js | pino-probot

You can test the environment variables by setting them inline

node my-script.js | LOG_FORMAT=json pino-probot

Programmatic usage

@probot/pino exports a getTransformStream() method which can be passed as 2nd argument to pino()

import pino from "pino";
import { getTransformStream } from "@probot/pino";

const log = pino(
  {
    name: "probot",
  },
  getTransformStream()
);

This won't log anything to stdout though. In order to pass the formatted logs back to stdout, do the following

import pino from "pino";
import { getTransformStream } from "@probot/pino";

const transform = getTransformStream();
transform.pipe(pino.destination(1));
const log = pino(
  {
    name: "probot",
  },
  transform
);

With custom options:

const transform = getTransformStream({
  logFormat: "json",
  logLevelInString: true,
  sentryDsn: "http://username@example.com/1234",
});

Options

The pino-probot binary can be configured using environment variables, while the getTransformStream() accepts an object with according keys

Environment VaribaleOptionDescription
LOG_FORMATlogFormatSet to pretty or json. When set to pretty, logs are formatted for human readability. Setting to json logs using JSON objects. Defaults to pretty
LOG_LEVEL_IN_STRINGlogLevelInStringBy default, when using the json format, the level printed in the log records is an int (10, 20, ..). This option tells the logger to print level as a string: {"level": "info"}. Default false
SENTRY_DSNsentryDsnSet to a Sentry DSN to report all errors thrown by your app.

(Example: https://1234abcd@sentry.io/12345)

Contributing

See CONTRIBUTING.md

License

ISC

Keywords

FAQs

Package last updated on 20 Jan 2021

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc