npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@octotask/pino

v2.5.1

Published

formats pino logs and sends errors to Sentry

Downloads

398

Readme

@octotask/pino

formats pino logs and sends errors to Sentry

About

@octotask/pino is currently built into octotask, you don't need to manually pipe octotask's logs into it. It will be easy to move it out of octotask 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-octotask

You can test the environment variables by setting them inline

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

Programmatic usage

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

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

const log = pino(
  {
    name: "octotask",
  },
  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 "@octotask/pino";

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

With custom options:

const transform = getTransformStream({
  logFormat: "json",
  logLevelInString: true,
  sentryDsn: "http://[email protected]/1234",
});

Options

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

| Environment Varibale | Option | Description | | --------------------- | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | LOG_FORMAT | logFormat | Set 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_STRING | logLevelInString | By 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_DSN | sentryDsn | Set to a Sentry DSN to report all errors thrown by your app. (Example: https://[email protected]/12345) |

Contributing

See CONTRIBUTING.md

License

ISC