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

@99mini/console-logger

v1.0.1

Published

A flexible console logger library supporting both functional and object-oriented paradigms

Readme

Console Logger

A flexible console logging library for JavaScript and TypeScript applications that supports both object-oriented and functional programming paradigms.

Features

  • Support for both ESM and CommonJS modules
  • TypeScript support with full type definitions
  • Multiple log levels (DEBUG, INFO, WARN, ERROR)
  • Customizable log formatting (timestamps, colors, prefixes)
  • Both object-oriented and functional API
  • Comprehensive test coverage

Installation

# Using npm
npm install @99mini/console-logger

# Using yarn
yarn add @99mini/console-logger

# Using pnpm
pnpm add @99mini/console-logger

Usage

Object-Oriented Approach

import { Logger, LogLevel } from '@99mini/console-logger';

// Create a new logger instance
const logger = new Logger({
  minLevel: LogLevel.DEBUG,
  format: {
    timestamp: true,
    level: true,
    prefix: 'APP',
    colors: true,
  },
});

// Log messages
logger.log('Log message');
logger.info('Info message');
logger.debug('Debug message');
logger.warn('Warning message');
logger.error('Error message', new Error('Something went wrong'));

// Change configuration at runtime
logger.setLevel(LogLevel.WARN);
logger.setEnabled(false);
logger.configure({
  format: {
    prefix: 'NEW-PREFIX',
  },
});

Functional Approach

import {
  log,
  info,
  debug,
  warn,
  error,
  setLevel,
  configure,
  LogLevel,
} from '@99mini/console-logger';

// Log messages using the default logger
log('Log message');
info('Info message');
debug('Debug message');
warn('Warning message');
error('Error message', new Error('Something went wrong'));

// Configure the default logger
setLevel(LogLevel.DEBUG);
configure({
  format: {
    prefix: 'FUNC-API',
    timestamp: true,
  },
});

debug('Debug message now visible');

// Create a custom logger instance
import { createLogger } from '@99mini/console-logger';

const customLogger = createLogger({
  minLevel: LogLevel.ERROR,
  format: {
    prefix: 'CUSTOM',
  },
});

customLogger.error('This is a critical error');

API Reference

Logger Class

class Logger {
  constructor(options?: Partial<LoggerOptions>);

  debug(message: unknown, ...args: unknown[]): void;
  log(message: unknown, ...args: unknown[]): void;
  info(message: unknown, ...args: unknown[]): void;
  warn(message: unknown, ...args: unknown[]): void;
  error(message: unknown, ...args: unknown[]): void;

  setLevel(level: LogLevel): void;
  setEnabled(enabled: boolean): void;
  configure(options: Partial<LoggerOptions>): void;
}

Functional API

function createLogger(options?: Partial<LoggerOptions>): Logger;
function configure(options: Partial<LoggerOptions>): void;
function setLevel(level: LogLevel): void;
function setEnabled(enabled: boolean): void;

function debug(message: unknown, ...args: unknown[]): void;
function log(message: unknown, ...args: unknown[]): void;
function info(message: unknown, ...args: unknown[]): void;
function warn(message: unknown, ...args: unknown[]): void;
function error(message: unknown, ...args: unknown[]): void;

function resetDefaultLogger(): void;

Types

enum LogLevel {
  DEBUG = 'debug',
  INFO = 'info',
  WARN = 'warn',
  ERROR = 'error',
}

interface LogFormatOptions {
  timestamp?: boolean;
  level?: boolean;
  prefix?: string;
  colors?: boolean;
}

interface LoggerOptions {
  minLevel?: LogLevel;
  format?: LogFormatOptions;
  enabled?: boolean;
}

Development

# Install dependencies
pnpm install

# Run tests
pnpm test

# Build the library
pnpm build

# Lint the code
pnpm lint

# Format the code
pnpm format

License

MIT