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

belog

v1.3.0

Published

Drop-in replacement for console.log debugging

Readme

Belog

Belog is a drop-in replacement for console.log debugging. It's shorter, simpler and provides better logging experience = belog.

This zero-dependency, universal package works seamlessly in both the browser and Node.js environments.

console.log() debugging has never been easier! 😃

Features

  • Log timestamps: Automatically adds timestamps to your logs.
  • Log prefix: Automatically adds default or custom prefix for better context.
  • Conditional Logging: Easily enable logs when condition matches.
  • Color Selection: Choose log colors for better visibility.
  • Logging to File: Save logs to a file (Node.js only).

Note: Belog is intended for debugging purposes, not for production logging!

Install

Install Belog via npm:

npm i belog

Usage

Here's a basic example of how to use Belog:

import belog from 'belog';

belog('hello world!');

This outputs log with prefix "belog" for easier searching in you terminal and a timestamp.

Log output example:

> belog [09:31:32.617]: hello world!

belog() can be treated as a shorter alias for console.log() with additional enhancements.

Since belog is just a wrapper around console.log(), it supports all the arguments that console.log() does. This means you can use it in the same way you would use console.log(), but with the added benefits and cleaner api of method chaining.

Chain method calls

You can chain methods together in a Fluent API fashion.

belog('hello').withPrefix('start').inColor('blue').when(isValid);

withPrefix(prefix: string)

Set a prefix for the log message. Default prefix is "belog".

belog('hello world!').withPrefix('react');
// react [09:31:32.617]: hello world!

when(condition: boolean)

Set a condition for logging.

const isAdult = age > 18;
belog('hello').when(isAdult);

toFile(filename?: string)

Log the message to a file. If the file does not exist, it will be created. If the file exists, the message will be appended to it.

filename param is optional, default is "belog.log". File will be created in project root directory.

Not supported in Browser!

belog('hello').toFile('log.txt');

To overwrite the file instead of appending, you can set the second parameter to true:

belog('hello').toFile('log.txt', true);

inColor(color: string)

Set the color for the console log.

Possible colors are:

"grey" | "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white"
belog('hello').inColor('green');