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

iflog

v0.3.0

Published

A conditional console.log that can be toggled on demand

Readme

iflog

A conditional console utility that only logs in development mode. It wraps all standard console methods and only outputs when process.env.NODE_ENV !== 'production'. Now with URL parameter override and manual controls for production debugging!

Installation

npm i iflog

Usage

import iflog from "iflog";

iflog.log("This will only log in development!");
iflog.error("This error will only show in development!");
iflog.table([{ a: 1 }, { a: 2 }]);

if (iflog.isEnabled()) {
  // do something only when logging is enabled
}

// Manual control
iflog.enable(); // Force enable logging (even in production)
iflog.disable(); // Force disable logging (even in development)

Production Debugging

Need to debug logs in production? You have two options:

1. URL Parameter Override

Simply add ?iflog=true to your URL:

https://yoursite.com/page?iflog=true

2. Manual Enable/Disable

Use the enable() and disable() methods for programmatic control:

iflog.enable(); // Force logging on
iflog.log("This will show even in production");
iflog.disable(); // Force logging off

Both methods will override the environment detection and give you full control over iflog's behavior. This enables you to add keyboard shortcuts to toggle logging in production or bind to a button in your app.

How it works

All methods are no-ops in production (process.env.NODE_ENV === 'production'), except when:

  • The URL parameter ?iflog=true is present, OR
  • iflog.enable() has been called

In development, they proxy to the corresponding console methods, unless iflog.disable() has been called.

API

All methods below only output when iflog is enabled (development mode, URL override, or manually enabled):

  • iflog.assert(condition, ...args)
  • iflog.clear()
  • iflog.count(label)
  • iflog.countReset(label)
  • iflog.debug(...args)
  • iflog.dir(...args)
  • iflog.dirxml(...args)
  • iflog.error(...args)
  • iflog.exception(...args) (alias for error)
  • iflog.group(...args)
  • iflog.groupCollapsed(...args)
  • iflog.groupEnd()
  • iflog.info(...args)
  • iflog.log(...args)
  • iflog.profile(label)
  • iflog.profileEnd(label)
  • iflog.table(tabularData, properties)
  • iflog.time(label)
  • iflog.timeEnd(label)
  • iflog.timeLog(label, ...args)
  • iflog.timeStamp(label)
  • iflog.trace(...args)
  • iflog.warn(...args)

Control Methods

  • iflog.enable() - Force enable logging regardless of environment
  • iflog.disable() - Force disable logging regardless of environment
  • iflog.toggle() - Toggle between enabled and disabled states
  • iflog.isEnabled() - Returns true if logging is enabled, false otherwise
  • iflog.reset() - Reset to default behavior

License

MIT