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

@feizk/logger

v2.1.0

Published

A lightweight, pluggable logger with colored outputs, structured logging, and transport support

Readme

@feizk/logger

A lightweight, pluggable logger with colored outputs, structured logging, and transport support.

Features

  • 🚀 Zero dependencies - No external runtime dependencies
  • 🎨 Colored output - ANSI color codes for terminal output
  • 📊 6 log levels - trace, debug, info, warn, error, fatal
  • 📝 Structured logging - JSON mode for production environments
  • 🔌 Pluggable transports - Add custom transports (files, databases, etc.)
  • 👶 Child loggers - Create prefixed loggers with merged context
  • ⏱️ Custom timestamps - Presets (iso, locale) or custom format
  • 🎯 Type-safe - Full TypeScript support

Installation

npm install @feizk/logger

Usage

import { Logger } from '@feizk/logger';

const logger = new Logger();

logger.info('Hello, world!');
logger.warn('This is a warning');
logger.error('This is an error');
logger.debug('Debug information');
logger.trace('Very detailed trace');
logger.fatal('Critical error!');

Options

| Option | Type | Default | Description | | -------------- | -------------------------------------------------------------- | ----------- | ---------------------------- | | level | 'trace' \| 'debug' \| 'info' \| 'warn' \| 'error' \| 'fatal' | 'debug' | Minimum log level to output | | silent | boolean | false | Suppress all console output | | enableColors | boolean | true | Enable colored output | | timestamp | 'iso' \| 'locale' \| (date: Date) => string | 'iso' | Timestamp format | | json | boolean | false | Output logs as JSON | | formatter | (entry: LogEntry) => string | undefined | Custom log formatter | | transports | Transport[] | [] | Initial transports to attach | | prefix | string | undefined | Prefix for all log messages | | context | Record<string, unknown> | {} | Initial context metadata |

API

Logger Methods

  • trace(...args) - Log a trace message (most verbose)
  • debug(...args) - Log a debug message
  • info(...args) - Log an info message
  • warn(...args) - Log a warning message
  • error(...args) - Log an error message
  • fatal(...args) - Log a fatal message (most severe)
  • setLevel(level) - Set the minimum log level
  • getLevel() - Get the current log level
  • addTransport(transport) - Add a custom transport
  • removeTransport(transport) - Remove a transport
  • child(options) - Create a child logger
  • destroy() - Destroy the logger and all transports

Log Levels

Logs are filtered by severity. The order from least to most severe:

  1. trace - Very detailed debugging information
  2. debug - Detailed information for debugging
  3. info - General informational messages
  4. warn - Warning conditions
  5. error - Error conditions
  6. fatal - Critical errors

Advanced Usage

Custom Timestamp

const logger = new Logger({
  timestamp: 'locale', // or 'iso' (default)
});

// Custom format
const logger = new Logger({
  timestamp: (date) => date.toISOString(),
});

Custom Formatter

const logger = new Logger({
  formatter: (entry) =>
    `[${entry.timestamp}] [${entry.level.toUpperCase()}] ${entry.args.join(' ')}`,
});

JSON Structured Logging

const logger = new Logger({ json: true });
logger.info('User logged in', { userId: '123' });
// Output: {"level":"info","timestamp":"2024-01-01T00:00:00.000Z","message":"User logged in","context":{"userId":"123"}}

Child Logger

const parent = new Logger({ prefix: 'app', context: { version: '1.0.0' } });

const child = parent.child({
  prefix: 'api',
  context: { endpoint: '/users' },
});

child.info('Request received');
// Output includes prefix "app:api" and merged context

Pluggable Transports

import { Logger, type Transport, type LogEntry } from '@feizk/logger';

// Create a custom transport
class FileTransport implements Transport {
  private stream: WriteStream;

  constructor(path: string) {
    this.stream = createWriteStream(path);
  }

  log(entry: LogEntry): void {
    this.stream.write(JSON.stringify(entry) + '\n');
  }

  destroy(): void {
    this.stream.end();
  }
}

// Use the transport
const logger = new Logger();
logger.addTransport(new FileTransport('/var/log/app.log'));
logger.info('This will be logged to the file');

Migration from v1.x

Discord Transport

Discord transport has been moved to a separate package. Use @feizk/logger-discord instead:

// v1.x
const logger = new Logger({
  discord: { enable: true, webhookURL: '...' },
});

// v2.x
import { Logger } from '@feizk/logger';
import { DiscordTransport } from '@feizk/logger-discord';

const logger = new Logger();
logger.addTransport(new DiscordTransport({ webhookURL: '...' }));

Removed Options

  • discord - Use @feizk/logger-discord instead
  • formatTimestamp - Use timestamp instead
  • formatLog - Use formatter instead

License

MIT