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-rotating-file-stream

v0.0.2

Published

A transport for pino that rotates logs

Downloads

543

Readme

pino-rotating-file-stream

NPM Package Version

Description

This module provides a transport for pino to automatically rotates logs. Under the hood, it uses rotating-file-stream even though some fields have been added to the default Options.

CLI

The current version of this packages has only support for the module usage as described in the Programmatic Integration section. This feature will be added in next versions of the package. For now you can rely on @vrbo/pino-rotating-file for CLI integration.

Programmatic Integration

Install pino-rotating-file-stream alongside pino and set the transport to pino-rotating-file-stream:

const pino = require('pino')
const logger = pino({
  transport: {
    target: 'pino-rotating-file-stream',
    options: {
      filename: 'app.log', // Required
      path: './logs', // Required
    },
  },
})

logger.info('hi')

See also the example in the examples folder.

Options

The options are essentially the same provided by rotating-file-stream except form two new entries. The following list shows all the options with the default values:

{
  filename: string; // Specifies the name of the file. Required.
  path: string // Specifies the base path for files. Required.
  size: string // Specifies the file size to rotate the file. Default: '100M'.
  maxSize: string // Specifies the maximum size of rotated files to keep. Default: '1G'.
  interval: string // Specifies the time interval to rotate the file. Default: '7d'.
  compress: boolean | string | Function // Specifies compression method of rotated files. Default: 'gzip'.
  encoding: string // Specifies the default encoding. Default: 'utf8'.
  history: string // Specifies the history filename. Default: null.
  immutable: boolean // Never mutate file names. Default: null.
  initialRotation: boolean // Initial rotation based on not-rotated file timestamp. Default: null.
  intervalBoundary: boolean // Makes rotated file name with lower boundary of rotation period. Default: null.
  maxFiles: number // Specifies the maximum number of rotated files to keep. Default: null.
  mode: number // Proxied to fs.createWriteStream. Default: 0o666.
  omitExtension: // boolean Omits the .gz extension from compressed rotated files. Default: null.
  rotate: number // Enables the classical UNIX logrotate behaviour. Default: null.
  teeToStdout: boolean // Writes file content to stdout as well. Default: null.
}

License

MIT License © 2023 Angelo Delicato