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

@lashdlhaldsfhoq/simpler

v2.0.1

Published

A simple utility to unset console.log arguments and provide enhanced logging capabilities

Readme

Simpler

A powerful utility library for managing console.log behavior and creating enhanced loggers with TypeScript support.

Features

  • Console Control: Easily unset and restore console.log functionality
  • Enhanced Loggers: Create loggers with timestamps, colors, prefixes, and log levels
  • Log Buffering: Buffer logs and flush them when needed
  • Performance Timing: Measure and log execution times
  • Conditional Logging: Log based on conditions or environment
  • Group & Table Support: Use console.group and console.table with enhanced features
  • TypeScript Support: Full TypeScript types included

Installation

npm install simpler

Usage

Basic Console Control

import { unsetConsoleLog, restoreConsoleLog, simpler } from 'simpler';

// Disable console.log
unsetConsoleLog();
console.log('This will not appear');

// Restore console.log
restoreConsoleLog();
console.log('This will appear');

// Quick disable using simpler()
simpler();

Create Enhanced Loggers

import { createLogger } from 'simpler';

// Create a logger with custom options
const logger = createLogger({
  timestamp: true,
  prefix: 'MyApp',
  color: true,
  minLevel: 'info' // Only log info and above
});

logger.debug('Debug message'); // Won't show (below minLevel)
logger.info('Info message');   // Will show with timestamp and prefix
logger.error('Error message'); // Will show in red

// Use advanced features
logger.group('Processing');
logger.time('operation');
// ... do something
logger.timeEnd('operation');
logger.groupEnd();

// Display data in table format
logger.table([
  { name: 'John', age: 30 },
  { name: 'Jane', age: 25 }
]);

Log Buffering

import { createBufferedLogger } from 'simpler';

const logger = createBufferedLogger({ prefix: 'Buffer' });

// Logs are stored, not printed
logger.log('First message');
logger.error('Error occurred');
logger.info('Info message');

// Flush all logs at once
logger.buffer.flush();

// Clear buffer without flushing
logger.buffer.clear();

// Get buffer entries
const entries = logger.buffer.getEntries();

Conditional and Environment Logging

import { conditionalLog, devLog } from 'simpler';

// Log only when condition is true
const debugMode = true;
conditionalLog(debugMode, 'Debug information');

// Log only in development environment
devLog('This only appears when NODE_ENV=development');

Utility Functions

import { prefixLog, jsonLog, measureTime, unsetAllConsole, restoreAllConsole } from 'simpler';

// Log with prefix
prefixLog('SERVER', 'Request received');

// Pretty print JSON
const data = { users: [{ name: 'John', age: 30 }] };
jsonLog(data, 4); // 4 spaces indentation

// Measure execution time
const result = await measureTime(async () => {
  await someAsyncOperation();
  return 'done';
}, 'Operation');
// Logs: "Operation: 123.45ms"

// Disable/restore all console methods
unsetAllConsole();  // Disables log, info, warn, error, debug
restoreAllConsole(); // Restores all methods

API Reference

Console Control

  • unsetConsoleLog() - Disables console.log
  • restoreConsoleLog() - Restores console.log
  • unsetAllConsole() - Disables all console methods
  • restoreAllConsole() - Restores all console methods
  • simpler() - Quick function to unset console.log

Logger Creation

  • createLogger(options) - Creates an enhanced logger
  • createSilentLogger(options) - Creates a logger and unsets console.log
  • createBufferedLogger(options) - Creates a buffered logger

Logger Options

interface LogOptions {
  timestamp?: boolean;    // Add timestamps to logs
  prefix?: string;       // Add prefix to all logs
  color?: boolean;       // Use colors in output
  minLevel?: 'debug' | 'log' | 'info' | 'warn' | 'error'; // Minimum log level
}

Utility Functions

  • conditionalLog(condition, ...args) - Log when condition is true
  • devLog(...args) - Log only in development
  • prefixLog(prefix, ...args) - Log with a prefix
  • jsonLog(data, indent?) - Pretty print JSON
  • measureTime(fn, label?) - Measure function execution time

License

MIT