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

pino-http-print

v3.1.0

Published

Debug HTTP printer for pino

Downloads

77,913

Readme

pino-http-print

CI

Debug HTTP printer for pino

[1574071926285] GET http://localhost:20000/api/activity/component 200\n

Usage as Pino Transport

You can use this module as a pino transport like so:

const pino = require('pino')
const transport = pino.transport({
  target: 'pino-http-print',
  level: 'info',
  options: {
    destination: 1, // optional (default stdout)
    all: true,
    colorize: false,
    translateTime: true
    ... // other options
  }
})
pino(transport)

The options object's properties are described below. There is only one extra property:

  • prettyOptions: this property is forwarded to pino-pretty for non-http logs (when all is true). It must be pino-pretty options object.

Usage as module

Supports

const { httpPrintFactory } = require('pino-http-print')
const printer = httpPrintFactory()
var logger = require('pino-http')(printer)
const { httpPrintFactory } = require('pino-http-print')
const printer = httpPrintFactory()
const logger = require('express-pino-logger')(printer)

Same for koa-pino-logger and restify-pino-logger, just pass in the printer stream.

API

httpPrintFactory(options, pinoPrettyOptions) => ( Function([Stream]) => Stream )

Returns a new printer. The common options between this and pino-pretty options are set from the first object itself. pinoPrettyOptions is forwarded to pino-pretty for non-http logs (when all is true).

See the Options section for all possible options.

printer([Stream]) => Stream

Returns a stream that will pull off

Options

Options argument for httpPrintFactory with keys corresponding to the options described in CLI Arguments:

{
  colorize: colorette.isColorSupported, // --colorize
  all: false, // --all
  translateTime: false, // --translateTime
  relativeUrl: false, // --relativeUrl
  lax: false  // --lax
}

The colorize default follows colorette.isColorSupported.

Usage as Pino Legacy Transport

Pino supports a legacy transport interface that is still supported by this module.

npm install -g pino-http-print

Spin up server that uses a pino http logger and pipe it to pino-http-print

node server | pino-http-print

CLI Arguments

  • -all (-a): Causes pino-http-print to also print non-HTTP log messages by passing them through to pino-pretty.
  • --colorize (-c): Adds terminal color escape sequences to the output.
  • --translateTime (-t): Translate the epoch time value into a human readable date and time string. This flag also can set the format string to apply when translating the date to human readable format. This is the same as pino-pretty translateTime
    • The default format is yyyy-mm-dd HH:MM:ss.l o in UTC.
  • --relativeUrl (-r): print only the relative url

LICENSE

MIT

Acknowledgements