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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@rs-r2d2/log4ts

v1.0.3

Published

A powerful, flexible logging library for TypeScript inspired by Apache Log4j, featuring colored output and emojis

Readme

Log4TS

A powerful, flexible logging library for TypeScript applications with colored output and emojis. Inspired by Apache Log4j, this library brings the robust logging patterns of Log4j to the TypeScript ecosystem.

Inspiration

Log4TS is inspired by Apache Log4j, bringing its proven logging patterns and concepts to TypeScript:

  • Hierarchical logging architecture
  • Multiple output appenders
  • Customizable layouts
  • Log levels
  • Pattern-based formatting

While maintaining these core concepts, Log4TS adds modern features like:

  • 🎨 Colored console output
  • 🎯 TypeScript-first implementation
  • 🎁 Emoji indicators for different log levels
  • 📝 Modern ES6+ features

Features

  • 🎨 Colored console output
  • 🎯 Multiple log levels (TRACE, DEBUG, INFO, WARN, ERROR, FATAL)
  • 🔧 Customizable layouts and patterns
  • 🎁 Emoji indicators for different log levels
  • 📝 Placeholder substitution ({})
  • ⚡ Stack trace support for errors
  • 🔌 Extensible appender system

Installation

npm install @rs-r2d2/log4ts

Quick Start

import { LogManager, ConsoleAppender } from '@rs-r2d2/log4ts';

// Get a logger instance
const logger = LogManager.getLogger('MyApp');

// Add console appender
logger.addAppender(new ConsoleAppender());

// Log some messages
logger.info('Application started');
logger.debug('Processing data: {}', someData);
logger.error('An error occurred', error);

Log Levels

The library supports the following log levels (in order of severity):

  • 🔍 TRACE - Detailed debugging information
  • 🐛 DEBUG - Debugging information
  • ℹ️ INFO - General information
  • ⚠️ WARN - Warning messages
  • ❌ ERROR - Error messages
  • 💀 FATAL - Critical errors that may cause application termination

Pattern Layout

The pattern layout supports the following placeholders:

  • %d - Date/time
  • %p - Log level
  • %c - Logger name
  • %m - Log message

Example:

new PatternLayout('[%d] [%p] %c - %m');

Custom Colors and Icons

You can customize colors and icons for different log levels:

const customConfig = new ColorConfig({
    [LogLevel.INFO]: { color: 'blue', icon: '✨' }
});

const layout = new PatternLayout('[%d] [%p] %c - %m', customConfig);
const appender = new ConsoleAppender(layout);

Testing

Run the test suite:

npm test

License

MIT