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 🙏

© 2026 – Pkg Stats / Ryan Hefner

pino-file-logger-transport

v2.1.1

Published

A Pino transport for file logging with rotation and archiving capabilities

Readme

🚀 Features

  • Smart Log Rotation - Automatic daily and size-based log rotation with customizable naming
  • Intelligent Archiving - Archive old logs in ZIP, GZIP, or TAR formats
  • Configurable Retention - Automatic cleanup of old logs based on retention policy
  • High Performance - Buffered writes and async I/O for optimal performance
  • Flexible Filtering - Log level filtering to control verbosity
  • Robust Error Handling - Graceful degradation without crashing your application
  • Pino Ecosystem - Seamless integration with Pino logger ecosystem

📦 Installation

npm install pino-file-logger-transport

✅ Compatibility

| Package line | Node.js | Pino | |--------------|---------|------| | 1.x | >=16 | ^9 | | 2.x | >=20 | ^9.14.0 \|\| ^10.0.0 |

🔄 Migration Notes

  • If your project is on Node.js 18, stay on 1.x:
npm install pino-file-logger-transport@^1
  • Use 2.x for Node.js 20+ and official pino@10 support.
  • Size-based rotation options (maxFileSizeMB, maxFiles) are available starting from 2.1.0.

🎯 Quick Start

const pino = require('pino');

const transport = pino.transport({
  target: 'pino-file-logger-transport',
  options: {
    logDirectory: './logs',
    filename: 'app',
    retentionDays: 7,
  },
});

const logger = pino(transport);

logger.info('Hello world!');
logger.error('Something went wrong');

⚙️ Configuration

const transport = pino.transport({
  target: 'pino-file-logger-transport',
  options: {
    // Required: Directory for log files
    logDirectory: './logs',
    
    // Optional: Base filename (default: 'log')
    filename: 'my-app',
    
    // Optional: Days to retain logs (default: 7)
    retentionDays: 30,
    
    // Optional: Minimum log level (default: 'info')
    level: 'warn',
    
    // Optional: Archive format (default: 'zip')
    archiveFormat: 'gzip',
    
    // Optional: Buffer size for performance (default: 100)
    bufferSize: 50,

    // Optional: Rotate file when size is reached in MB (disabled by default, since 2.1.0)
    maxFileSizeMB: 50,

    // Optional: Maximum managed files per directory (disabled by default, since 2.1.0)
    maxFiles: 100,
  },
});

const logger = pino(transport);

🛠 Advanced Usage

const pino = require('pino');

const transport = pino.transport({
  target: 'pino-file-logger-transport',
  options: {
    logDirectory: './logs',
    filename: 'application',
    retentionDays: 14,
    level: 'info',
    bufferSize: 100,
    flushInterval: 1000,
    archiveFormat: 'zip',
    compressionLevel: 6,
    archiveDirectory: './archives',
    cleanupOnRotation: true,
    archiveOnRotation: true,
  },
});

const logger = pino(transport);

// Structured logging
logger.info({ userId: 123, action: 'login' }, 'User authenticated');

// Error logging with stack traces
logger.error(new Error('Database connection failed'), 'Critical system error');

// Child loggers
const authServiceLogger = logger.child({ service: 'auth' });
authServiceLogger.info('Authentication service initialized');

📖 Documentation

For complete documentation, visit our docs:

🧪 Testing

npm test

📄 License

MIT © ProydakD